diff --git a/internal/orchestrator/helpers.go b/internal/orchestrator/helpers.go index 773b0f677..820415787 100644 --- a/internal/orchestrator/helpers.go +++ b/internal/orchestrator/helpers.go @@ -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 @@ -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 diff --git a/internal/orchestrator/helpers_test.go b/internal/orchestrator/helpers_test.go index e4f893553..ba3485686 100644 --- a/internal/orchestrator/helpers_test.go +++ b/internal/orchestrator/helpers_test.go @@ -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},