From ecb9b620fe54108683345b2e6085b1772d15ebe3 Mon Sep 17 00:00:00 2001 From: Jeffrey Ying Date: Wed, 26 Jan 2022 13:30:03 -0500 Subject: [PATCH] Revert "Populate OpenAPI in all integration tests" --- test/integration/apiserver/apiserver_test.go | 3 +++ test/integration/apiserver/apply/apply_test.go | 2 ++ test/integration/apiserver/flowcontrol/concurrency_test.go | 1 + test/integration/apiserver/openapi_test.go | 1 + test/integration/apiserver/openapiv3_test.go | 2 ++ test/integration/auth/rbac_test.go | 1 + test/integration/framework/controlplane_utils.go | 5 ----- 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/integration/apiserver/apiserver_test.go b/test/integration/apiserver/apiserver_test.go index e171f437ebc..b1ba28d06d5 100644 --- a/test/integration/apiserver/apiserver_test.go +++ b/test/integration/apiserver/apiserver_test.go @@ -93,6 +93,7 @@ func setupWithResourcesWithOptions(t testing.TB, opts *framework.ControlPlaneCon resourceConfig.EnableResources(resources...) controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig } + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() _, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig) clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1}) @@ -226,6 +227,7 @@ func Test4xxStatusCodeInvalidPatch(t *testing.T) { func TestCacheControl(t *testing.T) { controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{}) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig) defer closeFn() @@ -272,6 +274,7 @@ func TestCacheControl(t *testing.T) { // Tests that the apiserver returns HSTS headers as expected. func TestHSTS(t *testing.T) { controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{}) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() controlPlaneConfig.GenericConfig.HSTSDirectives = []string{"max-age=31536000", "includeSubDomains"} instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig) defer closeFn() diff --git a/test/integration/apiserver/apply/apply_test.go b/test/integration/apiserver/apply/apply_test.go index 412ce1cbe0a..aec9e9ea138 100644 --- a/test/integration/apiserver/apply/apply_test.go +++ b/test/integration/apiserver/apply/apply_test.go @@ -58,6 +58,7 @@ func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server resourceConfig.EnableVersions(groupVersions...) controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig } + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() _, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig) clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1}) @@ -2821,6 +2822,7 @@ func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) { controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{ EtcdOptions: sharedEtcd, }) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)() _, instanceConfig, closeFn := framework.RunAnAPIServer(controlPlaneConfig) diff --git a/test/integration/apiserver/flowcontrol/concurrency_test.go b/test/integration/apiserver/flowcontrol/concurrency_test.go index 2f9b297239c..7c5a11be9d4 100644 --- a/test/integration/apiserver/flowcontrol/concurrency_test.go +++ b/test/integration/apiserver/flowcontrol/concurrency_test.go @@ -60,6 +60,7 @@ func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFligh }) controlPlaneConfig.GenericConfig.MaxRequestsInFlight = maxReadonlyRequestsInFlight controlPlaneConfig.GenericConfig.MaxMutatingRequestsInFlight = MaxMutatingRequestsInFlight + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig _, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig) diff --git a/test/integration/apiserver/openapi_test.go b/test/integration/apiserver/openapi_test.go index a6f89e92283..6d320f42779 100644 --- a/test/integration/apiserver/openapi_test.go +++ b/test/integration/apiserver/openapi_test.go @@ -56,6 +56,7 @@ func TestEnablingOpenAPIEnumTypes(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.OpenAPIEnums, tc.featureEnabled)() controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{}) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() controlPlaneConfig.GenericConfig.OpenAPIConfig.GetDefinitions = openapi.GetOpenAPIDefinitionsWithoutDisabledFeatures(func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { defs := generated.GetOpenAPIDefinitions(ref) def := defs[typeToAddEnum] diff --git a/test/integration/apiserver/openapiv3_test.go b/test/integration/apiserver/openapiv3_test.go index 4a621b39c08..105da645963 100644 --- a/test/integration/apiserver/openapiv3_test.go +++ b/test/integration/apiserver/openapiv3_test.go @@ -46,6 +46,7 @@ import ( func TestOpenAPIV3SpecRoundTrip(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.OpenAPIV3, true)() controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{}) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig) defer closeFn() paths := []string{ @@ -199,6 +200,7 @@ func TestOpenAPIV3ProtoRoundtrip(t *testing.T) { t.Skip("Skipping OpenAPI V3 Proto roundtrip test") defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.OpenAPIV3, true)() controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{}) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig) defer closeFn() rt, err := restclient.TransportFor(instanceConfig.GenericAPIServer.LoopbackClientConfig) diff --git a/test/integration/auth/rbac_test.go b/test/integration/auth/rbac_test.go index b158f569819..029873d9f78 100644 --- a/test/integration/auth/rbac_test.go +++ b/test/integration/auth/rbac_test.go @@ -535,6 +535,7 @@ func TestRBAC(t *testing.T) { "limitrange-patcher": {Name: "limitrange-patcher"}, "user-with-no-permissions": {Name: "user-with-no-permissions"}, }))) + controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() _, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig) defer closeFn() diff --git a/test/integration/framework/controlplane_utils.go b/test/integration/framework/controlplane_utils.go index 8b1421f8f12..9513a9fa4e1 100644 --- a/test/integration/framework/controlplane_utils.go +++ b/test/integration/framework/controlplane_utils.go @@ -285,11 +285,6 @@ func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOpt // TODO: get rid of these tests or port them to secure serving controlPlaneConfig.GenericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}} - // Enable OpenAPI and Server Side Apply in integration tests - if controlPlaneConfig.GenericConfig.OpenAPIConfig == nil { - controlPlaneConfig.GenericConfig.OpenAPIConfig = DefaultOpenAPIConfig() - } - return controlPlaneConfig }