From 35531b210c4198e6613c9fcd232838a942a8c469 Mon Sep 17 00:00:00 2001 From: Sarah Gibson Date: Tue, 17 Dec 2024 16:33:27 +0000 Subject: [PATCH] Ensure variable name consistency --- deployer/commands/generate/helm_upgrade/decision.py | 6 +++--- deployer/commands/generate/helm_upgrade/jobs.py | 5 +---- tests/test_helm_upgrade_decision.py | 12 ++++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/deployer/commands/generate/helm_upgrade/decision.py b/deployer/commands/generate/helm_upgrade/decision.py index e2e5cd147..75a770387 100644 --- a/deployer/commands/generate/helm_upgrade/decision.py +++ b/deployer/commands/generate/helm_upgrade/decision.py @@ -72,7 +72,7 @@ def filter_out_staging_hubs(all_hub_matrix_jobs): function. Returns: - staging_matrix_jobs (list[dict]): A list of dictionaries representing + staging_hub_matrix_jobs (list[dict]): A list of dictionaries representing matrix jobs to upgrade staging hubs on clusters that require it. prod_hub_matrix_jobs (list[dict]): A list of dictionaries representing matrix jobs to upgrade all production hubs, i.e., those without "staging" in their @@ -302,8 +302,8 @@ def assign_staging_jobs_for_missing_clusters( staging_hub_matrix_jobs now have an associated support/staging job. """ prod_hub_clusters = {job["cluster_name"] for job in prod_hub_matrix_jobs} - staging_clusters = {job["cluster_name"] for job in staging_hub_matrix_jobs} - missing_clusters = prod_hub_clusters.difference(staging_clusters) + staging_hub_clusters = {job["cluster_name"] for job in staging_hub_matrix_jobs} + missing_clusters = prod_hub_clusters.difference(staging_hub_clusters) if missing_clusters: # Generate staging jobs for clusters that don't have them but do have diff --git a/deployer/commands/generate/helm_upgrade/jobs.py b/deployer/commands/generate/helm_upgrade/jobs.py index c819decea..0af83746a 100644 --- a/deployer/commands/generate/helm_upgrade/jobs.py +++ b/deployer/commands/generate/helm_upgrade/jobs.py @@ -117,10 +117,7 @@ def helm_upgrade_jobs( ) # Clean up the matrix jobs - # support_and_staging_matrix_jobs = ensure_support_staging_jobs_have_correct_keys( - # support_and_staging_matrix_jobs, prod_hub_matrix_jobs - # ) - staging_matrix_jobs = assign_staging_jobs_for_missing_clusters( + staging_hub_matrix_jobs = assign_staging_jobs_for_missing_clusters( staging_hub_matrix_jobs, prod_hub_matrix_jobs ) # Pretty print the jobs using rich diff --git a/tests/test_helm_upgrade_decision.py b/tests/test_helm_upgrade_decision.py index b300c0175..a69ab990b 100644 --- a/tests/test_helm_upgrade_decision.py +++ b/tests/test_helm_upgrade_decision.py @@ -385,7 +385,7 @@ def test_filter_out_staging_hubs_job_exists(): }, ] - expected_staging_hub_matrix_jobs = [ + expected_staging_matrix_jobs = [ { "cluster_name": "cluster1", "provider": "gcp", @@ -403,12 +403,12 @@ def test_filter_out_staging_hubs_job_exists(): ] ( - result_staging_hub_matrix_jobs, + result_staging_matrix_jobs, result_prod_hub_matrix_jobs, ) = filter_out_staging_hubs(input_hub_matrix_jobs) case.assertCountEqual( - result_staging_hub_matrix_jobs, expected_staging_hub_matrix_jobs + result_staging_matrix_jobs, expected_staging_matrix_jobs ) case.assertCountEqual(result_prod_hub_matrix_jobs, expected_prod_hub_matrix_jobs) @@ -431,7 +431,7 @@ def test_filter_out_staging_hubs_job_does_not_exist(): }, ] - expected_staging_hub_matrix_jobs = [ + expected_staging_matrix_jobs = [ { "cluster_name": "cluster1", "provider": "gcp", @@ -452,12 +452,12 @@ def test_filter_out_staging_hubs_job_does_not_exist(): "deployer.utils.file_acquisition.CONFIG_CLUSTERS_PATH", clusters_path ): ( - result_staging_hub_matrix_jobs, + result_staging_matrix_jobs, result_prod_hub_matrix_jobs, ) = filter_out_staging_hubs(input_hub_matrix_jobs) case.assertCountEqual( - result_staging_hub_matrix_jobs, expected_staging_hub_matrix_jobs + result_staging_matrix_jobs, expected_staging_matrix_jobs ) case.assertCountEqual(result_prod_hub_matrix_jobs, expected_prod_hub_matrix_jobs)