Skip to content

Commit

Permalink
Not ruining 100% test coverage on setup_kubernetes_jobs.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cuza committed Oct 25, 2023
1 parent 58e31fc commit c24dc52
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion tests/test_setup_kubernetes_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def simple_create_application_object(
service=service_instance_config.service,
cluster=cluster,
instance=service_instance_config.instance,
config_dict=KubernetesDeploymentConfigDict(),
config_dict=service_instance_config.config_dict,
branch_dict=None,
soa_dir=soa_dir,
)
Expand Down Expand Up @@ -512,6 +512,47 @@ def simple_create_application_object(
mock_log_obj.info.reset_mock()
mock_no_metrics.reset_mock()

# Skipping downthenup instance cuz of existing_apps
fake_create.reset_mock()
fake_update.reset_mock()
fake_update_related_api_objects.reset_mock()
mock_list_all_paasta_deployments.return_value = [
KubeDeployment(
service="kurupt",
instance="fm",
git_sha="2",
namespace="paastasvc-kurupt",
image_version="extrastuff-1",
config_sha="1",
replicas=1,
)
]
mock_downthenup_kube_deploy_config = KubernetesDeploymentConfig(
service="kurupt",
instance="fm",
cluster="fake_cluster",
soa_dir="/nail/blah",
config_dict=KubernetesDeploymentConfigDict(bounce_method="downthenup"),
branch_dict=None,
)
mock_service_instance_configs_list = [
(True, mock_downthenup_kube_deploy_config)
]
setup_kube_deployments(
kube_client=mock_client,
service_instance_configs_list=mock_service_instance_configs_list,
cluster="fake_cluster",
soa_dir="/nail/blah",
metrics_interface=mock_no_metrics,
eks=eks_flag,
)
assert fake_create.call_count == 0
assert fake_update.call_count == 0
assert fake_update_related_api_objects.call_count == 0
assert mock_no_metrics.emit_event.call_count == 0
mock_log_obj.info.reset_mock()
mock_no_metrics.reset_mock()

# Update when gitsha changed
fake_create.reset_mock()
fake_update.reset_mock()
Expand Down

0 comments on commit c24dc52

Please sign in to comment.