Fix deployment verification to wait for correct version

- Modified check_deployment.py to wait for the correct commit hash
- Now retries until the expected version is deployed (not just site responding)
- Prevents performance tests from running against old versions
- Maintains existing retry logic with proper version checking
- Only runs functionality tests after version verification passes
This commit is contained in:
Oliver Falk
2025-10-24 11:00:05 +02:00
parent 7350afd988
commit 80df736433

View File

@@ -345,6 +345,8 @@ def test_deployment(
# Check if we're looking for a specific version and compare # Check if we're looking for a specific version and compare
current_commit = get_current_commit_hash() current_commit = get_current_commit_hash()
version_ok = True
if current_commit and deployed_commit != "Unknown": if current_commit and deployed_commit != "Unknown":
if deployed_commit == current_commit: if deployed_commit == current_commit:
colored_print( colored_print(
@@ -363,43 +365,53 @@ def test_deployment(
) )
elif comparison is False: elif comparison is False:
colored_print( colored_print(
"⚠️ Warning: Deployed version appears to be older than expected", f"⚠️ Deployed version ({deployed_commit[:8]}) is older than expected ({current_commit[:8]})",
Colors.YELLOW, Colors.YELLOW,
) )
colored_print(
f"Waiting for deployment to update... (attempt {attempt}/{max_retries})",
Colors.BLUE,
)
version_ok = False
else: else:
colored_print( colored_print(
"⚠️ Warning: Could not determine version relationship", "⚠️ Warning: Could not determine version relationship - proceeding with tests",
Colors.YELLOW, Colors.YELLOW,
) )
# Run functionality tests # Only proceed with functionality tests if version is correct
colored_print("Running basic functionality tests...", Colors.YELLOW) if not version_ok:
# Version is not correct, skip tests and retry
# Test avatar redirect pass # Will continue to retry logic below
if test_avatar_redirect(base_url):
colored_print("✅ Invalid avatar redirects correctly", Colors.GREEN)
else: else:
colored_print("❌ Invalid avatar redirect failed", Colors.RED) # Run functionality tests
return False colored_print("Running basic functionality tests...", Colors.YELLOW)
# Test avatar sizing # Test avatar redirect
if test_avatar_sizing(base_url): if test_avatar_redirect(base_url):
pass # Success messages are printed within the function colored_print("✅ Invalid avatar redirects correctly", Colors.GREEN)
else: else:
return False colored_print("❌ Invalid avatar redirect failed", Colors.RED)
return False
# Test stats endpoint # Test avatar sizing
if test_stats_endpoint(base_url): if test_avatar_sizing(base_url):
colored_print("✅ Stats endpoint working", Colors.GREEN) pass # Success messages are printed within the function
else: else:
colored_print("❌ Stats endpoint failed", Colors.RED) return False
return False
colored_print( # Test stats endpoint
f"🎉 {name} deployment verification completed successfully!", if test_stats_endpoint(base_url):
Colors.GREEN, colored_print("✅ Stats endpoint working", Colors.GREEN)
) else:
return True colored_print("❌ Stats endpoint failed", Colors.RED)
return False
colored_print(
f"🎉 {name} deployment verification completed successfully!",
Colors.GREEN,
)
return True
else: else:
colored_print(f"{name} site not responding yet...", Colors.YELLOW) colored_print(f"{name} site not responding yet...", Colors.YELLOW)