Skip to content

Commit

Permalink
Add big-bounce test for non-default configs (#3975)
Browse files Browse the repository at this point in the history
This test should grow over time to include other commonly used
options/configs: e.g., the various types of secrets and whatnot
  • Loading branch information
nemacysts authored Oct 7, 2024
1 parent 4854ceb commit 3158208
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion tests/test_kubernetes_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4242,7 +4242,7 @@ def test_load_custom_resources():
]


def test_warning_big_bounce():
def test_warning_big_bounce_default_config():
job_config = kubernetes_tools.KubernetesDeploymentConfig(
service="service",
instance="instance",
Expand Down Expand Up @@ -4332,6 +4332,53 @@ def test_warning_big_bounce_routable_pod():
), "If this fails, just change the constant in this test, but be aware that deploying this change will cause every smartstack-registered service to bounce!"


def test_warning_big_bounce_common_config():
job_config = kubernetes_tools.KubernetesDeploymentConfig(
service="service",
instance="instance",
cluster="cluster",
config_dict={
# XXX: this should include other common options that are used
"cap_add": ["SET_GID"],
},
branch_dict={
"docker_image": "abcdef",
"git_sha": "deadbeef",
"image_version": None,
"force_bounce": None,
"desired_state": "start",
},
)

with mock.patch(
"paasta_tools.utils.load_system_paasta_config",
return_value=SystemPaastaConfig(
{
"volumes": [],
"hacheck_sidecar_volumes": [],
"expected_slave_attributes": [{"region": "blah"}],
"docker_registry": "docker-registry.local",
},
"/fake/dir/",
),
autospec=True,
) as mock_load_system_paasta_config, mock.patch(
"paasta_tools.kubernetes_tools.load_system_paasta_config",
new=mock_load_system_paasta_config,
autospec=False,
), mock.patch(
"paasta_tools.kubernetes_tools.load_service_namespace_config",
return_value=ServiceNamespaceConfig(),
autospec=True,
):
assert (
job_config.format_kubernetes_app().spec.template.metadata.labels[
"paasta.yelp.com/config_sha"
]
== "configb24f9dd2"
), "If this fails, just change the constant in this test, but be aware that deploying this change will cause every service to bounce!"


@pytest.mark.parametrize(
"pod_node_name,node,expected",
[
Expand Down

0 comments on commit 3158208

Please sign in to comment.