mirror of
https://github.com/moby/moby.git
synced 2026-01-11 10:41:43 +00:00
api/types/container: make HealthStatus a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user