Prepare calendar before running tests
This commit is contained in:
@@ -89,12 +89,19 @@ jobs:
|
|||||||
attempt=$((attempt + 1))
|
attempt=$((attempt + 1))
|
||||||
if [ $attempt -ge $max_attempts ]; then
|
if [ $attempt -ge $max_attempts ]; then
|
||||||
echo "Calendar app not ready after $max_attempts attempts."
|
echo "Calendar app not ready after $max_attempts attempts."
|
||||||
|
# Debug output
|
||||||
|
echo "Final calendar check response:"
|
||||||
|
curl -u admin:admin -v -X PROPFIND http://localhost:8080/remote.php/dav/calendars/admin
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Calendar app attempt $attempt/$max_attempts: Not ready, sleeping for 3 seconds..."
|
echo "Calendar app attempt $attempt/$max_attempts: Not ready, sleeping for 5 seconds..."
|
||||||
sleep 3
|
sleep 5
|
||||||
done
|
done
|
||||||
echo "Calendar app is ready."
|
echo "Calendar app is ready."
|
||||||
|
|
||||||
|
# Additional verification - wait longer for CalDAV to be fully ready
|
||||||
|
echo "Waiting additional 10 seconds for CalDAV service to stabilize..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
echo "All required apps are installed and ready!"
|
echo "All required apps are installed and ready!"
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e # Exit on any error
|
||||||
|
|
||||||
|
echo "Installing and configuring Calendar app..."
|
||||||
|
|
||||||
|
# Enable calendar app
|
||||||
php /var/www/html/occ app:enable calendar
|
php /var/www/html/occ app:enable calendar
|
||||||
|
|
||||||
|
# Wait for calendar app to be fully initialized
|
||||||
|
echo "Waiting for calendar app to initialize..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# Ensure maintenance mode is off before calendar operations
|
||||||
|
php /var/www/html/occ maintenance:mode --off
|
||||||
|
|
||||||
|
# Create a default calendar for the admin user (may already exist, ignore errors)
|
||||||
|
echo "Creating default calendar..."
|
||||||
|
php /var/www/html/occ dav:create-calendar admin personal "Personal" "Default personal calendar" || true
|
||||||
|
|
||||||
|
# Sync DAV system to ensure proper initialization
|
||||||
|
echo "Syncing DAV system..."
|
||||||
|
php /var/www/html/occ dav:sync-system-addressbook
|
||||||
|
|
||||||
|
# Repair calendar app to ensure proper setup
|
||||||
|
echo "Repairing calendar app..."
|
||||||
|
php /var/www/html/occ maintenance:repair --include-expensive
|
||||||
|
|
||||||
|
# Final wait to ensure CalDAV service is fully ready
|
||||||
|
echo "Final CalDAV initialization wait..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
echo "Calendar app installation complete!"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"""CalDAV client for NextCloud calendar operations."""
|
"""CalDAV client for NextCloud calendar operations."""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
from typing import Dict, Any, List, Optional, Tuple
|
from typing import Dict, Any, List, Optional, Tuple
|
||||||
@@ -45,10 +46,23 @@ class CalendarClient(BaseNextcloudClient):
|
|||||||
"Accept": "application/xml",
|
"Accept": "application/xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
response = await self._client.request(
|
# Retry logic for CalDAV initialization issues
|
||||||
"PROPFIND", caldav_path, content=propfind_body, headers=headers
|
max_retries = 3
|
||||||
)
|
for attempt in range(max_retries):
|
||||||
response.raise_for_status()
|
try:
|
||||||
|
response = await self._client.request(
|
||||||
|
"PROPFIND", caldav_path, content=propfind_body, headers=headers
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
break
|
||||||
|
except HTTPStatusError as e:
|
||||||
|
if e.response.status_code == 401 and attempt < max_retries - 1:
|
||||||
|
logger.warning(
|
||||||
|
f"CalDAV auth failed (attempt {attempt + 1}/{max_retries}), retrying in 2s..."
|
||||||
|
)
|
||||||
|
await asyncio.sleep(2)
|
||||||
|
continue
|
||||||
|
raise
|
||||||
|
|
||||||
# Parse XML response
|
# Parse XML response
|
||||||
root = ET.fromstring(response.content)
|
root = ET.fromstring(response.content)
|
||||||
|
|||||||
Reference in New Issue
Block a user