mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 09:24:23 +00:00
Add tests for status cli
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package status
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -26,6 +27,11 @@ const (
|
||||
UnknownStatus Status = "Unknown"
|
||||
)
|
||||
|
||||
var (
|
||||
Statuses = []Status{InProgressStatus, FailedStatus, CurrentStatus, TerminatingStatus, UnknownStatus}
|
||||
ConditionTypes = []ConditionType{ConditionFailed, ConditionInProgress}
|
||||
)
|
||||
|
||||
// ConditionType defines the set of condition types allowed inside a Condition struct.
|
||||
type ConditionType string
|
||||
|
||||
@@ -42,6 +48,18 @@ func (s Status) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StatusFromString turns a string into a Status. Will panic if the provided string is
|
||||
// not a valid status.
|
||||
func FromStringOrDie(text string) Status {
|
||||
s := Status(text)
|
||||
for _, r := range Statuses {
|
||||
if s == r {
|
||||
return s
|
||||
}
|
||||
}
|
||||
panic(fmt.Errorf("string has invalid status: %s", s))
|
||||
}
|
||||
|
||||
// Result contains the results of a call to compute the status of
|
||||
// a resource.
|
||||
type Result struct {
|
||||
|
||||
Reference in New Issue
Block a user