Sanitized single-commit public mirror of recipe-maintainer. - Removed test-ssh/.testenv (live creds); added test-ssh/.testenv.example placeholders. - Removed plans/ and planned-updates/ (deployment-planning docs) so no client/ deployment domains appear in the public repo. - All other secret stores were already gitignored. - docs.coopcloud.tech retained as a submodule (public upstream).
91 lines
3.1 KiB
Python
Executable File
91 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Celery Beat WOPI scheduling test."""
|
|
import argparse
|
|
import json
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
|
|
from utils.tests.helpers import run, resolve_domain, resolve_server
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('--domain', default=os.environ.get('TEST_DOMAIN'))
|
|
args = parser.parse_args()
|
|
domain = args.domain or resolve_domain('lasuite-drive')
|
|
server = resolve_server()
|
|
|
|
print("Testing Celery Beat WOPI scheduling")
|
|
print()
|
|
|
|
# Step 1: Verify celery-beat service is running
|
|
print("Step 1: Checking celery-beat service is running ...")
|
|
result = run(f"abra app ps {domain} --chaos --no-input -m", check=False, timeout=60)
|
|
try:
|
|
data = json.loads(result.stdout)
|
|
if 'celery-beat' in data:
|
|
print(" PASS: celery-beat service is running")
|
|
else:
|
|
print(" FAIL: celery-beat service not found in running services")
|
|
sys.exit(1)
|
|
except (json.JSONDecodeError, TypeError):
|
|
print(" FAIL: Could not parse service list")
|
|
print(f" Output: {result.stdout}")
|
|
sys.exit(1)
|
|
|
|
# Step 2: Verify old scheduler service is gone
|
|
print("Step 2: Checking old scheduler service is removed ...")
|
|
if 'scheduler' in data:
|
|
print(" FAIL: old scheduler service still appears in service list")
|
|
sys.exit(1)
|
|
print(" PASS: old scheduler service is not running")
|
|
|
|
# Step 3: Wait for WOPI task to fire and check logs
|
|
print("Step 3: Waiting for WOPI configuration task to fire (up to 90s) ...")
|
|
print(" (test instance should have WOPI_CONFIGURATION_CRONTAB_MINUTE=* for every-minute execution)")
|
|
|
|
found_task = False
|
|
beat_logs = ""
|
|
celery_logs = ""
|
|
|
|
for i in range(1, 7):
|
|
print(f" Checking logs (attempt {i}/6, waiting 15s) ...")
|
|
time.sleep(15)
|
|
|
|
# Check celery-beat logs for the task being sent
|
|
result = run(
|
|
f"ssh {server} 'docker logs $(docker ps -q -f name=lasuite-drive.*celery-beat) 2>&1 | tail -20'",
|
|
check=False, timeout=30,
|
|
)
|
|
beat_logs = result.stdout
|
|
|
|
if any("sending due task configure_wopi_clients" in line.lower() for line in beat_logs.split('\n')):
|
|
print(" PASS: Celery Beat is sending the WOPI configuration task")
|
|
found_task = True
|
|
break
|
|
|
|
# Check celery worker logs for task execution
|
|
result = run(
|
|
f"ssh {server} 'docker logs $(docker ps -q -f name=lasuite-drive.*_celery\\.) 2>&1 | grep -i configure_wopi | tail -5'",
|
|
check=False, timeout=30,
|
|
)
|
|
celery_logs = result.stdout
|
|
|
|
if "configure_wopi" in celery_logs.lower() and "succeeded" in celery_logs.lower():
|
|
print(" PASS: WOPI configuration task executed successfully on celery worker")
|
|
found_task = True
|
|
break
|
|
|
|
if not found_task:
|
|
print(" FAIL: WOPI configuration task not found in logs after 90 seconds")
|
|
sys.exit(1)
|
|
|
|
print()
|
|
print("PASS: Celery Beat WOPI scheduling test passed")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|