From 80df7364335fcd1e39c475df604bb33b334510e9 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 24 Oct 2025 11:00:05 +0200 Subject: [PATCH] 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 --- scripts/check_deployment.py | 66 ++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/scripts/check_deployment.py b/scripts/check_deployment.py index 6fcbe4e..145a881 100755 --- a/scripts/check_deployment.py +++ b/scripts/check_deployment.py @@ -345,6 +345,8 @@ def test_deployment( # Check if we're looking for a specific version and compare current_commit = get_current_commit_hash() + version_ok = True + if current_commit and deployed_commit != "Unknown": if deployed_commit == current_commit: colored_print( @@ -363,43 +365,53 @@ def test_deployment( ) elif comparison is False: 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, ) + colored_print( + f"Waiting for deployment to update... (attempt {attempt}/{max_retries})", + Colors.BLUE, + ) + version_ok = False else: colored_print( - "⚠️ Warning: Could not determine version relationship", + "⚠️ Warning: Could not determine version relationship - proceeding with tests", Colors.YELLOW, ) - - # Run functionality tests - colored_print("Running basic functionality tests...", Colors.YELLOW) - - # Test avatar redirect - if test_avatar_redirect(base_url): - colored_print("✅ Invalid avatar redirects correctly", Colors.GREEN) + + # Only proceed with functionality tests if version is correct + if not version_ok: + # Version is not correct, skip tests and retry + pass # Will continue to retry logic below else: - colored_print("❌ Invalid avatar redirect failed", Colors.RED) - return False + # Run functionality tests + colored_print("Running basic functionality tests...", Colors.YELLOW) - # Test avatar sizing - if test_avatar_sizing(base_url): - pass # Success messages are printed within the function - else: - return False + # Test avatar redirect + if test_avatar_redirect(base_url): + colored_print("✅ Invalid avatar redirects correctly", Colors.GREEN) + else: + colored_print("❌ Invalid avatar redirect failed", Colors.RED) + return False - # Test stats endpoint - if test_stats_endpoint(base_url): - colored_print("✅ Stats endpoint working", Colors.GREEN) - else: - colored_print("❌ Stats endpoint failed", Colors.RED) - return False + # Test avatar sizing + if test_avatar_sizing(base_url): + pass # Success messages are printed within the function + else: + return False - colored_print( - f"🎉 {name} deployment verification completed successfully!", - Colors.GREEN, - ) - return True + # Test stats endpoint + if test_stats_endpoint(base_url): + colored_print("✅ Stats endpoint working", Colors.GREEN) + else: + colored_print("❌ Stats endpoint failed", Colors.RED) + return False + + colored_print( + f"🎉 {name} deployment verification completed successfully!", + Colors.GREEN, + ) + return True else: colored_print(f"{name} site not responding yet...", Colors.YELLOW)