From ac5535c9491a3e1034c7b72e5d6eb9c94ca9dace Mon Sep 17 00:00:00 2001 From: Mengjiao Liu Date: Tue, 8 Jun 2021 16:53:15 +0800 Subject: [PATCH] test/integration: Rename MasterConfigOptions to ControlPlaneConfigOptions --- test/integration/apiserver/apiserver_test.go | 12 ++++++------ test/integration/apiserver/apply/apply_test.go | 4 ++-- .../apiserver/flowcontrol/concurrency_test.go | 2 +- test/integration/apiserver/watchcache_test.go | 2 +- test/integration/framework/master_utils.go | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/integration/apiserver/apiserver_test.go b/test/integration/apiserver/apiserver_test.go index 274ddafce69..ef1b2f0c574 100644 --- a/test/integration/apiserver/apiserver_test.go +++ b/test/integration/apiserver/apiserver_test.go @@ -75,15 +75,15 @@ func setup(t *testing.T, groupVersions ...schema.GroupVersion) (*httptest.Server return setupWithResources(t, groupVersions, nil) } -func setupWithOptions(t *testing.T, opts *framework.MasterConfigOptions, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) { +func setupWithOptions(t *testing.T, opts *framework.ControlPlaneConfigOptions, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) { return setupWithResourcesWithOptions(t, opts, groupVersions, nil) } func setupWithResources(t *testing.T, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) { - return setupWithResourcesWithOptions(t, &framework.MasterConfigOptions{}, groupVersions, resources) + return setupWithResourcesWithOptions(t, &framework.ControlPlaneConfigOptions{}, groupVersions, resources) } -func setupWithResourcesWithOptions(t *testing.T, opts *framework.MasterConfigOptions, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) { +func setupWithResourcesWithOptions(t *testing.T, opts *framework.ControlPlaneConfigOptions, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) { controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(opts) if len(groupVersions) > 0 || len(resources) > 0 { resourceConfig := controlplane.DefaultAPIResourceConfigSource() @@ -224,7 +224,7 @@ func Test4xxStatusCodeInvalidPatch(t *testing.T) { } func TestCacheControl(t *testing.T) { - controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{}) + controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{}) controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig) defer closeFn() @@ -331,7 +331,7 @@ func TestListOptions(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)() etcdOptions := framework.DefaultEtcdOptions() etcdOptions.EnableWatchCache = watchCacheEnabled - s, clientSet, closeFn := setupWithOptions(t, &framework.MasterConfigOptions{EtcdOptions: etcdOptions}) + s, clientSet, closeFn := setupWithOptions(t, &framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions}) defer closeFn() ns := framework.CreateTestingNamespace("list-options", s, t) @@ -563,7 +563,7 @@ func TestListResourceVersion0(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)() etcdOptions := framework.DefaultEtcdOptions() etcdOptions.EnableWatchCache = tc.watchCacheEnabled - s, clientSet, closeFn := setupWithOptions(t, &framework.MasterConfigOptions{EtcdOptions: etcdOptions}) + s, clientSet, closeFn := setupWithOptions(t, &framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions}) defer closeFn() ns := framework.CreateTestingNamespace("list-paging", s, t) diff --git a/test/integration/apiserver/apply/apply_test.go b/test/integration/apiserver/apply/apply_test.go index 1d632450558..9e64a522e09 100644 --- a/test/integration/apiserver/apply/apply_test.go +++ b/test/integration/apiserver/apply/apply_test.go @@ -50,7 +50,7 @@ import ( ) func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) { - opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()} + opts := framework.ControlPlaneConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()} opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf" controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts) if len(groupVersions) > 0 { @@ -2819,7 +2819,7 @@ spec: func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) { sharedEtcd := framework.DefaultEtcdOptions() - controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{ + controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{ EtcdOptions: sharedEtcd, }) controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() diff --git a/test/integration/apiserver/flowcontrol/concurrency_test.go b/test/integration/apiserver/flowcontrol/concurrency_test.go index 2f14de41f8f..7de81571476 100644 --- a/test/integration/apiserver/flowcontrol/concurrency_test.go +++ b/test/integration/apiserver/flowcontrol/concurrency_test.go @@ -50,7 +50,7 @@ const ( ) func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFlight int) (*httptest.Server, *rest.Config, framework.CloseFunc) { - opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()} + opts := framework.ControlPlaneConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()} opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf" controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts) resourceConfig := controlplane.DefaultAPIResourceConfigSource() diff --git a/test/integration/apiserver/watchcache_test.go b/test/integration/apiserver/watchcache_test.go index 9a266b81fea..82f78d6e168 100644 --- a/test/integration/apiserver/watchcache_test.go +++ b/test/integration/apiserver/watchcache_test.go @@ -54,7 +54,7 @@ func multiEtcdSetup(t testing.TB) (clientset.Interface, framework.CloseFunc) { etcdOptions.EtcdServersOverrides = []string{fmt.Sprintf("/events#%s", etcd1URL)} etcdOptions.EnableWatchCache = true - opts := framework.MasterConfigOptions{EtcdOptions: etcdOptions} + opts := framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions} controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts) // Switch off endpoints reconciler to avoid unnecessary operations. controlPlaneConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType diff --git a/test/integration/framework/master_utils.go b/test/integration/framework/master_utils.go index 777508f05c4..8a4e3d10770 100644 --- a/test/integration/framework/master_utils.go +++ b/test/integration/framework/master_utils.go @@ -253,12 +253,12 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer // NewIntegrationTestControlPlaneConfig returns the master config appropriate for most integration tests. func NewIntegrationTestControlPlaneConfig() *controlplane.Config { - return NewIntegrationTestControlPlaneConfigWithOptions(&MasterConfigOptions{}) + return NewIntegrationTestControlPlaneConfigWithOptions(&ControlPlaneConfigOptions{}) } // NewIntegrationTestControlPlaneConfigWithOptions returns the control plane config appropriate for most integration tests // configured with the provided options. -func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config { +func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config { controlPlaneConfig := NewControlPlaneConfigWithOptions(opts) controlPlaneConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4") controlPlaneConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource() @@ -269,8 +269,8 @@ func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) return controlPlaneConfig } -// MasterConfigOptions are the configurable options for a new integration test master config. -type MasterConfigOptions struct { +// ControlPlaneConfigOptions are the configurable options for a new integration test master config. +type ControlPlaneConfigOptions struct { EtcdOptions *options.EtcdOptions } @@ -286,11 +286,11 @@ func DefaultEtcdOptions() *options.EtcdOptions { // NewControlPlaneConfig returns a basic control plane config. func NewControlPlaneConfig() *controlplane.Config { - return NewControlPlaneConfigWithOptions(&MasterConfigOptions{}) + return NewControlPlaneConfigWithOptions(&ControlPlaneConfigOptions{}) } // NewControlPlaneConfigWithOptions returns a basic control plane config configured with the provided options. -func NewControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config { +func NewControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config { etcdOptions := DefaultEtcdOptions() if opts.EtcdOptions != nil { etcdOptions = opts.EtcdOptions