mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Revert "Populate OpenAPI in all integration tests"
This commit is contained in:
parent
be38633742
commit
ecb9b620fe
@ -93,6 +93,7 @@ func setupWithResourcesWithOptions(t testing.TB, opts *framework.ControlPlaneCon
|
|||||||
resourceConfig.EnableResources(resources...)
|
resourceConfig.EnableResources(resources...)
|
||||||
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
}
|
}
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1})
|
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) {
|
func TestCacheControl(t *testing.T) {
|
||||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
@ -272,6 +274,7 @@ func TestCacheControl(t *testing.T) {
|
|||||||
// Tests that the apiserver returns HSTS headers as expected.
|
// Tests that the apiserver returns HSTS headers as expected.
|
||||||
func TestHSTS(t *testing.T) {
|
func TestHSTS(t *testing.T) {
|
||||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
controlPlaneConfig.GenericConfig.HSTSDirectives = []string{"max-age=31536000", "includeSubDomains"}
|
controlPlaneConfig.GenericConfig.HSTSDirectives = []string{"max-age=31536000", "includeSubDomains"}
|
||||||
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
@ -58,6 +58,7 @@ func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server
|
|||||||
resourceConfig.EnableVersions(groupVersions...)
|
resourceConfig.EnableVersions(groupVersions...)
|
||||||
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
}
|
}
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1})
|
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{
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{
|
||||||
EtcdOptions: sharedEtcd,
|
EtcdOptions: sharedEtcd,
|
||||||
})
|
})
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)()
|
||||||
_, instanceConfig, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
_, instanceConfig, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
@ -60,6 +60,7 @@ func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFligh
|
|||||||
})
|
})
|
||||||
controlPlaneConfig.GenericConfig.MaxRequestsInFlight = maxReadonlyRequestsInFlight
|
controlPlaneConfig.GenericConfig.MaxRequestsInFlight = maxReadonlyRequestsInFlight
|
||||||
controlPlaneConfig.GenericConfig.MaxMutatingRequestsInFlight = MaxMutatingRequestsInFlight
|
controlPlaneConfig.GenericConfig.MaxMutatingRequestsInFlight = MaxMutatingRequestsInFlight
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ func TestEnablingOpenAPIEnumTypes(t *testing.T) {
|
|||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.OpenAPIEnums, tc.featureEnabled)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.OpenAPIEnums, tc.featureEnabled)()
|
||||||
|
|
||||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
controlPlaneConfig.GenericConfig.OpenAPIConfig.GetDefinitions = openapi.GetOpenAPIDefinitionsWithoutDisabledFeatures(func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
controlPlaneConfig.GenericConfig.OpenAPIConfig.GetDefinitions = openapi.GetOpenAPIDefinitionsWithoutDisabledFeatures(func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||||
defs := generated.GetOpenAPIDefinitions(ref)
|
defs := generated.GetOpenAPIDefinitions(ref)
|
||||||
def := defs[typeToAddEnum]
|
def := defs[typeToAddEnum]
|
||||||
|
@ -46,6 +46,7 @@ import (
|
|||||||
func TestOpenAPIV3SpecRoundTrip(t *testing.T) {
|
func TestOpenAPIV3SpecRoundTrip(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.OpenAPIV3, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.OpenAPIV3, true)()
|
||||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
paths := []string{
|
paths := []string{
|
||||||
@ -199,6 +200,7 @@ func TestOpenAPIV3ProtoRoundtrip(t *testing.T) {
|
|||||||
t.Skip("Skipping OpenAPI V3 Proto roundtrip test")
|
t.Skip("Skipping OpenAPI V3 Proto roundtrip test")
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.OpenAPIV3, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.OpenAPIV3, true)()
|
||||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
rt, err := restclient.TransportFor(instanceConfig.GenericAPIServer.LoopbackClientConfig)
|
rt, err := restclient.TransportFor(instanceConfig.GenericAPIServer.LoopbackClientConfig)
|
||||||
|
@ -535,6 +535,7 @@ func TestRBAC(t *testing.T) {
|
|||||||
"limitrange-patcher": {Name: "limitrange-patcher"},
|
"limitrange-patcher": {Name: "limitrange-patcher"},
|
||||||
"user-with-no-permissions": {Name: "user-with-no-permissions"},
|
"user-with-no-permissions": {Name: "user-with-no-permissions"},
|
||||||
})))
|
})))
|
||||||
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
|
@ -285,11 +285,6 @@ func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOpt
|
|||||||
// TODO: get rid of these tests or port them to secure serving
|
// TODO: get rid of these tests or port them to secure serving
|
||||||
controlPlaneConfig.GenericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}}
|
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
|
return controlPlaneConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user