diff --git a/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go b/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go index f0b12569e2f..baf52e439df 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go +++ b/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go @@ -232,17 +232,6 @@ func (u updateMyCRDV1Beta1Schema) Do(ctx *ratchetingTestContext) error { sch.Properties = map[string]apiextensionsv1.JSONSchemaProps{} } - if ctx.StatusSubresource { - sch = &apiextensionsv1.JSONSchemaProps{ - Type: "object", - Properties: map[string]apiextensionsv1.JSONSchemaProps{ - "status": *sch, - }, - } - } - - // sentinel must be in the root level of the schema. - // Do not include this in the status schema. uuidString := string(uuid.NewUUID()) sentinelName := "__ratcheting_sentinel_field__" sch.Properties[sentinelName] = apiextensionsv1.JSONSchemaProps{ @@ -252,6 +241,15 @@ func (u updateMyCRDV1Beta1Schema) Do(ctx *ratchetingTestContext) error { }}, } + if ctx.StatusSubresource { + sch = &apiextensionsv1.JSONSchemaProps{ + Type: "object", + Properties: map[string]apiextensionsv1.JSONSchemaProps{ + "status": *sch, + }, + } + } + for _, v := range myCRD.Spec.Versions { if v.Name != myCRDV1Beta1.Version { continue @@ -278,12 +276,7 @@ func (u updateMyCRDV1Beta1Schema) Do(ctx *ratchetingTestContext) error { name: "sentinel-resource", patch: map[string]interface{}{ sentinelName: fmt.Sprintf("invalid-%d", counter), - }}.Do(&ratchetingTestContext{ - T: ctx.T, - DynamicClient: ctx.DynamicClient, - APIExtensionsClient: ctx.APIExtensionsClient, - StatusSubresource: false, // Do not carry this over, sentinel check is in the root level. - }) + }}.Do(ctx) if err == nil { return false, errors.New("expected error when creating sentinel resource")