Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_status_from_container_state(notebook):

# If the Notebook is initializing, the status will be waiting
waiting_state = container_state["waiting"]
if ["reason"] == 'PodInitializing':
if waiting_state.get("reason") == 'PodInitializing':
status_phase = status.STATUS_PHASE.WAITING
status_message = waiting_state.get("reason", "Undetermined reason.")
return status_phase, status_message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_ready_container_state(self):
(None, None)
)

def test_no_message_container_state(self):
def test_pod_initializing_container_state(self):
container_state = {
"status": {
"containerState": {
Expand All @@ -45,8 +45,41 @@ def test_no_message_container_state(self):
}
}

self.assertEqual(
status.get_status_from_container_state(container_state),
("waiting", "PodInitializing")
)

def test_no_message_container_state(self):
container_state = {
"status": {
"containerState": {
"waiting": {
"reason": "ImagePullBackOff",
}
}
}
}

self.assertEqual(
status.get_status_from_container_state(container_state),
("warning",
"PodInitializing: No available message for container state.")
"ImagePullBackOff: No available message for container state.")
)

def test_waiting_container_state_with_message(self):
container_state = {
"status": {
"containerState": {
"waiting": {
"reason": "ImagePullBackOff",
"message": "Back-off pulling image",
}
}
}
}

self.assertEqual(
status.get_status_from_container_state(container_state),
("warning", "ImagePullBackOff: Back-off pulling image")
)
Loading