Skip to content

Commit

Permalink
Merge pull request Yelp#3161 from Yelp/PAASTA-17440_0_instances_is_no…
Browse files Browse the repository at this point in the history
…t_starting

Make new paasta status report the instance state as "Stopped" if the …
  • Loading branch information
stug authored Aug 6, 2021
2 parents f6d1163 + d1ec417 commit 4c5505d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paasta_tools/cli/cmds/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,10 @@ def get_instance_state(status: InstanceStatusKubernetesV2) -> str:
return PaastaColors.red("Stopping")
elif status.desired_state == "start":
if num_versions == 0:
return PaastaColors.yellow("Starting")
if status.desired_instances == 0:
return PaastaColors.red("Stopped")
else:
return PaastaColors.yellow("Starting")
if num_versions == 1:
if num_ready_replicas < status.desired_instances:
return PaastaColors.yellow("Launching replicas")
Expand Down
6 changes: 6 additions & 0 deletions tests/cli/test_cmds_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,12 @@ def test_stop(self, mock_kubernetes_status_v2):
mock_kubernetes_status_v2.desired_state = "stop"
assert "Stop" in get_instance_state(mock_kubernetes_status_v2)

def test_stop_if_0_desired_instances(self, mock_kubernetes_status_v2):
mock_kubernetes_status_v2.desired_state = "start"
mock_kubernetes_status_v2.versions = []
mock_kubernetes_status_v2.desired_instances = 0
assert "Stop" in get_instance_state(mock_kubernetes_status_v2)

def test_running(self, mock_kubernetes_status_v2):
mock_kubernetes_status_v2.desired_state = "start"
instance_state = get_instance_state(mock_kubernetes_status_v2)
Expand Down

0 comments on commit 4c5505d

Please sign in to comment.