File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
pkg/apis/postgres-operator.crunchydata.com/v1beta1 Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "time"
1111
1212 "gotest.tools/v3/assert"
13+ "k8s.io/kube-openapi/pkg/validation/strfmt"
1314 "sigs.k8s.io/yaml"
1415)
1516
@@ -104,6 +105,10 @@ func TestDurationYAML(t *testing.T) {
104105 var parsed Duration
105106 assert .NilError (t , yaml .Unmarshal ([]byte (tt .input ), & parsed ))
106107 assert .Equal (t , parsed .AsDuration ().Duration , tt .result )
108+
109+ // This is what Kubernetes calls when validating the "duration" format.
110+ // - https://releases.k8s.io/v1.32.0/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/validation.go#L116
111+ assert .Assert (t , strfmt .IsDuration (tt .input ))
107112 }
108113
109114 for _ , tt := range []string {
@@ -122,6 +127,10 @@ func TestDurationYAML(t *testing.T) {
122127 } {
123128 assert .ErrorContains (t ,
124129 yaml .Unmarshal ([]byte (tt ), new (Duration )), "unable to parse" )
130+
131+ // This is what Kubernetes calls when validating the "duration" format.
132+ // - https://releases.k8s.io/v1.32.0/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/validation/validation.go#L116
133+ assert .Assert (t , ! strfmt .IsDuration (tt ))
125134 }
126135 })
127136}
You can’t perform that action at this time.
0 commit comments