Skip to content
Draft
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
6 changes: 5 additions & 1 deletion internal/orchestrator/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func parseAppStatus(containers []container.Summary) []AppStatusInfo {
}

// ...else we have multiple different status we calculate the status
// among the possible left: {failed, stopping, starting}
// among the possible left: {failed, stopping, starting, stopped}
if slices.ContainsFunc(s, func(v Status) bool { return v == StatusFailed }) {
appendResult(appPath, StatusFailed)
continue
Expand All @@ -98,6 +98,10 @@ func parseAppStatus(containers []container.Summary) []AppStatusInfo {
appendResult(appPath, StatusStarting)
continue
}
if slices.ContainsFunc(s, func(v Status) bool { return v == StatusStopped }) {
appendResult(appPath, StatusFailed)
continue
}
}

return apps
Expand Down
6 changes: 6 additions & 0 deletions internal/orchestrator/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ func TestParseAppStatus(t *testing.T) {
statusMessage: []string{"Up 5 minutes", "Dead"},
want: StatusFailed,
},
{
name: "dangling container is failed",
containerState: []container.ContainerState{container.StateRunning, container.StateExited},
statusMessage: []string{"Up 10 minutes", "Exited (137)"},
want: StatusFailed,
},
{
name: "failed container takes precedence over stopping and starting",
containerState: []container.ContainerState{container.StateRunning, container.StateDead, container.StateRemoving, container.StateRestarting},
Expand Down
Loading