test/integration: Rename MasterConfigOptions to ControlPlaneConfigOptions

This commit is contained in:
Mengjiao Liu 2021-06-08 16:53:15 +08:00
parent f7cff077d5
commit ac5535c949
5 changed files with 16 additions and 16 deletions

View File

@ -75,15 +75,15 @@ func setup(t *testing.T, groupVersions ...schema.GroupVersion) (*httptest.Server
return setupWithResources(t, groupVersions, nil) 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) return setupWithResourcesWithOptions(t, opts, groupVersions, nil)
} }
func setupWithResources(t *testing.T, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) { 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) controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(opts)
if len(groupVersions) > 0 || len(resources) > 0 { if len(groupVersions) > 0 || len(resources) > 0 {
resourceConfig := controlplane.DefaultAPIResourceConfigSource() resourceConfig := controlplane.DefaultAPIResourceConfigSource()
@ -224,7 +224,7 @@ func Test4xxStatusCodeInvalidPatch(t *testing.T) {
} }
func TestCacheControl(t *testing.T) { func TestCacheControl(t *testing.T) {
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{}) controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig) master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
defer closeFn() defer closeFn()
@ -331,7 +331,7 @@ func TestListOptions(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)()
etcdOptions := framework.DefaultEtcdOptions() etcdOptions := framework.DefaultEtcdOptions()
etcdOptions.EnableWatchCache = watchCacheEnabled etcdOptions.EnableWatchCache = watchCacheEnabled
s, clientSet, closeFn := setupWithOptions(t, &framework.MasterConfigOptions{EtcdOptions: etcdOptions}) s, clientSet, closeFn := setupWithOptions(t, &framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions})
defer closeFn() defer closeFn()
ns := framework.CreateTestingNamespace("list-options", s, t) 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)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)()
etcdOptions := framework.DefaultEtcdOptions() etcdOptions := framework.DefaultEtcdOptions()
etcdOptions.EnableWatchCache = tc.watchCacheEnabled etcdOptions.EnableWatchCache = tc.watchCacheEnabled
s, clientSet, closeFn := setupWithOptions(t, &framework.MasterConfigOptions{EtcdOptions: etcdOptions}) s, clientSet, closeFn := setupWithOptions(t, &framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions})
defer closeFn() defer closeFn()
ns := framework.CreateTestingNamespace("list-paging", s, t) ns := framework.CreateTestingNamespace("list-paging", s, t)

View File

@ -50,7 +50,7 @@ import (
) )
func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) { 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" opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts) controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
if len(groupVersions) > 0 { if len(groupVersions) > 0 {
@ -2819,7 +2819,7 @@ spec:
func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) { func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) {
sharedEtcd := framework.DefaultEtcdOptions() sharedEtcd := framework.DefaultEtcdOptions()
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{ controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{
EtcdOptions: sharedEtcd, EtcdOptions: sharedEtcd,
}) })
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig() controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()

View File

@ -50,7 +50,7 @@ const (
) )
func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFlight int) (*httptest.Server, *rest.Config, framework.CloseFunc) { 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" opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts) controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
resourceConfig := controlplane.DefaultAPIResourceConfigSource() resourceConfig := controlplane.DefaultAPIResourceConfigSource()

View File

@ -54,7 +54,7 @@ func multiEtcdSetup(t testing.TB) (clientset.Interface, framework.CloseFunc) {
etcdOptions.EtcdServersOverrides = []string{fmt.Sprintf("/events#%s", etcd1URL)} etcdOptions.EtcdServersOverrides = []string{fmt.Sprintf("/events#%s", etcd1URL)}
etcdOptions.EnableWatchCache = true etcdOptions.EnableWatchCache = true
opts := framework.MasterConfigOptions{EtcdOptions: etcdOptions} opts := framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions}
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts) controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
// Switch off endpoints reconciler to avoid unnecessary operations. // Switch off endpoints reconciler to avoid unnecessary operations.
controlPlaneConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType controlPlaneConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType

View File

@ -253,12 +253,12 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
// NewIntegrationTestControlPlaneConfig returns the master config appropriate for most integration tests. // NewIntegrationTestControlPlaneConfig returns the master config appropriate for most integration tests.
func NewIntegrationTestControlPlaneConfig() *controlplane.Config { func NewIntegrationTestControlPlaneConfig() *controlplane.Config {
return NewIntegrationTestControlPlaneConfigWithOptions(&MasterConfigOptions{}) return NewIntegrationTestControlPlaneConfigWithOptions(&ControlPlaneConfigOptions{})
} }
// NewIntegrationTestControlPlaneConfigWithOptions returns the control plane config appropriate for most integration tests // NewIntegrationTestControlPlaneConfigWithOptions returns the control plane config appropriate for most integration tests
// configured with the provided options. // configured with the provided options.
func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config { func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config {
controlPlaneConfig := NewControlPlaneConfigWithOptions(opts) controlPlaneConfig := NewControlPlaneConfigWithOptions(opts)
controlPlaneConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4") controlPlaneConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource() controlPlaneConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()
@ -269,8 +269,8 @@ func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions)
return controlPlaneConfig return controlPlaneConfig
} }
// MasterConfigOptions are the configurable options for a new integration test master config. // ControlPlaneConfigOptions are the configurable options for a new integration test master config.
type MasterConfigOptions struct { type ControlPlaneConfigOptions struct {
EtcdOptions *options.EtcdOptions EtcdOptions *options.EtcdOptions
} }
@ -286,11 +286,11 @@ func DefaultEtcdOptions() *options.EtcdOptions {
// NewControlPlaneConfig returns a basic control plane config. // NewControlPlaneConfig returns a basic control plane config.
func NewControlPlaneConfig() *controlplane.Config { func NewControlPlaneConfig() *controlplane.Config {
return NewControlPlaneConfigWithOptions(&MasterConfigOptions{}) return NewControlPlaneConfigWithOptions(&ControlPlaneConfigOptions{})
} }
// NewControlPlaneConfigWithOptions returns a basic control plane config configured with the provided options. // 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() etcdOptions := DefaultEtcdOptions()
if opts.EtcdOptions != nil { if opts.EtcdOptions != nil {
etcdOptions = opts.EtcdOptions etcdOptions = opts.EtcdOptions