api/types/container: make HealthStatus a concrete type

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-11-07 18:36:12 +01:00
parent 1fd87e9fdf
commit db71c6a914
8 changed files with 27 additions and 24 deletions

View File

@@ -7,9 +7,7 @@ import (
)
// HealthStatus is a string representation of the container's health.
//
// It currently is an alias for string, but may become a distinct type in future.
type HealthStatus = string
type HealthStatus string
// Health states
const (
@@ -41,7 +39,10 @@ type HealthcheckResult struct {
}
var validHealths = []string{
NoHealthcheck, Starting, Healthy, Unhealthy,
string(NoHealthcheck),
string(Starting),
string(Healthy),
string(Unhealthy),
}
// ValidateHealthStatus checks if the provided string is a valid

View File

@@ -19,7 +19,7 @@ func TestValidateHealthStatus(t *testing.T) {
}
for _, tc := range tests {
t.Run(tc.health, func(t *testing.T) {
t.Run(string(tc.health), func(t *testing.T) {
err := ValidateHealthStatus(tc.health)
if tc.expectedErr == "" {
assert.NilError(t, err)