From 095823bc7ccaee70c7b30764c9813ca2bdeda4ef Mon Sep 17 00:00:00 2001 From: Jen Patague Date: Tue, 26 Nov 2024 12:25:31 -0800 Subject: [PATCH] Fix tests --- tests/cli/test_cmds_status.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/cli/test_cmds_status.py b/tests/cli/test_cmds_status.py index cef5ca266d..cb4457837e 100644 --- a/tests/cli/test_cmds_status.py +++ b/tests/cli/test_cmds_status.py @@ -1820,8 +1820,10 @@ def test_running(self, mock_kubernetes_status_v2): assert remove_ansi_escape_sequences(instance_state) == "Running" def test_bouncing(self, mock_kubernetes_status_v2): + old_version = mock_kubernetes_status_v2.versions[0] new_version = paastamodels.KubernetesVersion( - create_timestamp=1.0, + # ensure creation is after current version + create_timestamp=old_version.create_timestamp + 1000, git_sha="bbb111", config_sha="config111", ready_replicas=0, @@ -1832,9 +1834,29 @@ def test_bouncing(self, mock_kubernetes_status_v2): instance_state = remove_ansi_escape_sequences(instance_state) assert instance_state == "Bouncing to bbb111, config111" + def test_bouncing_ordering(self, mock_kubernetes_status_v2): + old_version = mock_kubernetes_status_v2.versions[0] + new_version = paastamodels.KubernetesVersion( + # ensure creation is _before_ current version + create_timestamp=old_version.create_timestamp - 1000, + git_sha="bbb111", + config_sha="config111", + ready_replicas=0, + ) + mock_kubernetes_status_v2.versions.append(new_version) + + instance_state = get_instance_state(mock_kubernetes_status_v2) + instance_state = remove_ansi_escape_sequences(instance_state) + assert instance_state != "Bouncing to bbb111, config111" + assert ( + instance_state + == f"Bouncing to {old_version.git_sha[:8]}, {old_version.config_sha}" + ) + def test_bouncing_git_sha_change_only(self, mock_kubernetes_status_v2): + old_version = mock_kubernetes_status_v2.versions[0] new_version = paastamodels.KubernetesVersion( - create_timestamp=1.0, + create_timestamp=old_version.create_timestamp + 1000, git_sha="bbb111", config_sha=mock_kubernetes_status_v2.versions[0].config_sha, ready_replicas=0,