Part of master to controlplane in test/integration

Rename NewIntegrationTestMasterConfig to NewIntegrationTestControlPlaneConfig
This commit is contained in:
Mengjiao Liu 2021-05-25 13:26:28 +08:00
parent b876623070
commit c9ec486287
31 changed files with 72 additions and 72 deletions

View File

@ -67,7 +67,7 @@ func TestWatchRestartsIfTimeoutNotReached(t *testing.T) {
timeout := 30 * time.Second
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
// Timeout is set random between MinRequestTimeout and 2x
masterConfig.GenericConfig.MinRequestTimeout = int(timeout.Seconds()) / 4
_, s, closeFn := framework.RunAMaster(masterConfig)

View File

@ -36,7 +36,7 @@ import (
)
func TestWatchClientTimeout(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()

View File

@ -84,7 +84,7 @@ func setupWithResources(t *testing.T, groupVersions []schema.GroupVersion, resou
}
func setupWithResourcesWithOptions(t *testing.T, opts *framework.MasterConfigOptions, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
masterConfig := framework.NewIntegrationTestMasterConfigWithOptions(opts)
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(opts)
if len(groupVersions) > 0 || len(resources) > 0 {
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
resourceConfig.EnableVersions(groupVersions...)
@ -224,7 +224,7 @@ func Test4xxStatusCodeInvalidPatch(t *testing.T) {
}
func TestCacheControl(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfigWithOptions(&framework.MasterConfigOptions{})
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{})
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
master, _, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()

View File

@ -52,7 +52,7 @@ import (
func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
masterConfig := framework.NewIntegrationTestMasterConfigWithOptions(&opts)
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
if len(groupVersions) > 0 {
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
resourceConfig.EnableVersions(groupVersions...)
@ -2819,7 +2819,7 @@ spec:
func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) {
sharedEtcd := framework.DefaultEtcdOptions()
masterConfig := framework.NewIntegrationTestMasterConfigWithOptions(&framework.MasterConfigOptions{
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{
EtcdOptions: sharedEtcd,
})
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()

View File

@ -52,7 +52,7 @@ const (
func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFlight int) (*httptest.Server, *rest.Config, framework.CloseFunc) {
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
masterConfig := framework.NewIntegrationTestMasterConfigWithOptions(&opts)
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
resourceConfig.EnableVersions(schema.GroupVersion{
Group: "flowcontrol.apiserver.k8s.io",

View File

@ -55,7 +55,7 @@ func multiEtcdSetup(t testing.TB) (clientset.Interface, framework.CloseFunc) {
etcdOptions.EnableWatchCache = true
opts := framework.MasterConfigOptions{EtcdOptions: etcdOptions}
masterConfig := framework.NewIntegrationTestMasterConfigWithOptions(&opts)
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
// Switch off endpoints reconciler to avoid unnecessary operations.
masterConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType
_, s, stopMaster := framework.RunAMaster(masterConfig)

View File

@ -55,7 +55,7 @@ func alwaysAlice(req *http.Request) (*authenticator.Response, bool, error) {
}
func TestSubjectAccessReview(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -146,7 +146,7 @@ func TestSubjectAccessReview(t *testing.T) {
func TestSelfSubjectAccessReview(t *testing.T) {
username := "alice"
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(func(req *http.Request) (*authenticator.Response, bool, error) {
return &authenticator.Response{
User: &user.DefaultInfo{Name: username},
@ -229,7 +229,7 @@ func TestSelfSubjectAccessReview(t *testing.T) {
}
func TestLocalSubjectAccessReview(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)

View File

@ -440,7 +440,7 @@ func getTestRequests(namespace string) []struct {
// TODO(etune): write a fuzz test of the REST API.
func TestAuthModeAlwaysAllow(t *testing.T) {
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()
@ -537,7 +537,7 @@ func getPreviousResourceVersionKey(url, id string) string {
func TestAuthModeAlwaysDeny(t *testing.T) {
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
_, s, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()
@ -586,7 +586,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
// This file has alice and bob in it.
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -655,7 +655,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
// should receive "Forbidden".
func TestBobIsForbidden(t *testing.T) {
// This file has alice and bob in it.
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -699,7 +699,7 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
// This file has alice and bob in it.
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -761,7 +761,7 @@ func (impersonateAuthorizer) Authorize(ctx context.Context, a authorizer.Attribu
func TestImpersonateIsForbidden(t *testing.T) {
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = impersonateAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -908,7 +908,7 @@ func TestAuthorizationAttributeDetermination(t *testing.T) {
trackingAuthorizer := &trackingAuthorizer{}
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = trackingAuthorizer
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -974,7 +974,7 @@ func TestNamespaceAuthorization(t *testing.T) {
`)
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = a
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -1072,7 +1072,7 @@ func TestKindAuthorization(t *testing.T) {
`)
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = a
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -1156,7 +1156,7 @@ func TestReadOnlyAuthorization(t *testing.T) {
a := newAuthorizerWithContents(t, `{"readonly": true}`)
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = a
_, s, closeFn := framework.RunAMaster(masterConfig)
@ -1233,7 +1233,7 @@ func testWebhookTokenAuthenticator(customDialer bool, t *testing.T) {
}
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)

View File

@ -117,7 +117,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
authenticator := bearertoken.New(bootstrap.NewTokenAuthenticator(bootstrapSecrets{test.secret}))
// Set up a master
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
_, s, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()

View File

@ -519,7 +519,7 @@ func TestRBAC(t *testing.T) {
for i, tc := range tests {
// Create an API Server.
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
superUser: {Name: "admin", Groups: []string{"system:masters"}},
@ -642,7 +642,7 @@ func TestRBAC(t *testing.T) {
func TestBootstrapping(t *testing.T) {
superUser := "admin/system:masters"
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
superUser: {Name: "admin", Groups: []string{"system:masters"}},
@ -703,7 +703,7 @@ func TestDiscoveryUpgradeBootstrapping(t *testing.T) {
superUser := "admin/system:masters"
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
superUser: {Name: "admin", Groups: []string{"system:masters"}},

View File

@ -83,7 +83,7 @@ func TestServiceAccountTokenCreate(t *testing.T) {
gcs := &clientset.Clientset{}
// Start the server
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysAllowAuthorizer()
masterConfig.GenericConfig.Authentication.APIAudiences = aud
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(

View File

@ -38,7 +38,7 @@ import (
)
func setup(t *testing.T) (*httptest.Server, framework.CloseFunc, *cronjob.Controller, *job.Controller, informers.SharedInformerFactory, clientset.Interface, restclient.Config) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: server.URL}

View File

@ -52,7 +52,7 @@ import (
var zero = int64(0)
func setup(t *testing.T) (*httptest.Server, framework.CloseFunc, *daemon.DaemonSetsController, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: server.URL}

View File

@ -103,7 +103,7 @@ func newDeployment(name, ns string, replicas int32) *apps.Deployment {
// dcSetup sets up necessities for Deployment integration test, including master, apiserver, informers, and clientset
func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, *deployment.DeploymentController, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}
@ -135,7 +135,7 @@ func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.R
// dcSimpleSetup sets up necessities for Deployment integration test, including master, apiserver,
// and clientset, but not controllers and informers
func dcSimpleSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}

View File

@ -51,7 +51,7 @@ func TestDualStackEndpoints(t *testing.T) {
dualStack := true
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, dualStack)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("Bad cidr: %v", err)

View File

@ -53,7 +53,7 @@ func TestCreateServiceSingleStackIPv4(t *testing.T) {
serviceCIDR := "10.0.0.0/16"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -270,7 +270,7 @@ func TestCreateServiceDualStackIPv6(t *testing.T) {
serviceCIDR := "2001:db8:1::/48"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -490,7 +490,7 @@ func TestCreateServiceDualStackIPv4IPv6(t *testing.T) {
secondaryServiceCIDR := "2001:db8:1::/48"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -717,7 +717,7 @@ func TestCreateServiceDualStackIPv6IPv4(t *testing.T) {
secondaryServiceCIDR := "10.0.0.0/16"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -947,7 +947,7 @@ func TestUpgradeDowngrade(t *testing.T) {
secondaryServiceCIDR := "2001:db8:1::/48"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -1062,7 +1062,7 @@ func TestConvertToFromExternalName(t *testing.T) {
secondaryServiceCIDR := "2001:db8:1::/48"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -1152,7 +1152,7 @@ func TestConvertToFromExternalName(t *testing.T) {
func TestExistingServiceDefaulting(t *testing.T) {
// Create an IPv4IPv6 dual stack control-plane
serviceCIDR := "10.0.0.0/16"
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -1235,7 +1235,7 @@ func TestPreferDualStack(t *testing.T) {
secondaryServiceCIDR := "2001:db8:1::/48"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, true)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)
@ -1320,7 +1320,7 @@ func TestServiceUpdate(t *testing.T) {
serviceCIDR := "10.0.0.0/16"
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.IPv6DualStack, false)()
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR(serviceCIDR)
if err != nil {
t.Fatalf("bad cidr: %v", err)

View File

@ -33,7 +33,7 @@ import (
)
func TestEndpointUpdates(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()

View File

@ -39,7 +39,7 @@ import (
)
func TestEndpointSliceMirroring(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()
@ -233,7 +233,7 @@ func TestEndpointSliceMirroring(t *testing.T) {
}
func TestEndpointSliceMirroringUpdates(t *testing.T) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()

View File

@ -421,7 +421,7 @@ func newV1Eviction(ns, evictionName string, deleteOption metav1.DeleteOptions) *
}
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *disruption.DisruptionController, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}

View File

@ -251,14 +251,14 @@ func startApiserverOrDie(controlPlaneConfig *controlplane.Config, incomingServer
return m, s, closeFn
}
// NewIntegrationTestMasterConfig returns the master config appropriate for most integration tests.
func NewIntegrationTestMasterConfig() *controlplane.Config {
return NewIntegrationTestMasterConfigWithOptions(&MasterConfigOptions{})
// NewIntegrationTestControlPlaneConfig returns the master config appropriate for most integration tests.
func NewIntegrationTestControlPlaneConfig() *controlplane.Config {
return NewIntegrationTestControlPlaneConfigWithOptions(&MasterConfigOptions{})
}
// NewIntegrationTestMasterConfigWithOptions returns the master config appropriate for most integration tests
// NewIntegrationTestControlPlaneConfigWithOptions returns the master config appropriate for most integration tests
// configured with the provided options.
func NewIntegrationTestMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
masterConfig := NewMasterConfigWithOptions(opts)
masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
masterConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()

View File

@ -607,7 +607,7 @@ func createJobWithDefaults(ctx context.Context, clientSet clientset.Interface, n
}
func setup(t *testing.T, nsBaseName string) (framework.CloseFunc, *restclient.Config, clientset.Interface, *v1.Namespace) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, masterCloseFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: server.URL}

View File

@ -140,13 +140,13 @@ func TestEmptyList(t *testing.T) {
}
func initStatusForbiddenControlPlaneConfig() *controlplane.Config {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
return masterConfig
}
func initUnauthorizedControlPlaneConfig() *controlplane.Config {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
tokenAuthenticator := tokentest.New()
tokenAuthenticator.Tokens[AliceToken] = &user.DefaultInfo{Name: "alice", UID: "1"}
tokenAuthenticator.Tokens[BobToken] = &user.DefaultInfo{Name: "bob", UID: "2"}
@ -601,7 +601,7 @@ func countEndpoints(eps *corev1.Endpoints) int {
}
func TestMasterService(t *testing.T) {
_, s, closeFn := framework.RunAMaster(framework.NewIntegrationTestMasterConfig())
_, s, closeFn := framework.RunAMaster(framework.NewIntegrationTestControlPlaneConfig())
defer closeFn()
client := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
@ -637,7 +637,7 @@ func TestMasterService(t *testing.T) {
}
func TestServiceAlloc(t *testing.T) {
cfg := framework.NewIntegrationTestMasterConfig()
cfg := framework.NewIntegrationTestControlPlaneConfig()
_, cidr, err := net.ParseCIDR("192.168.0.0/29")
if err != nil {
t.Fatalf("bad cidr: %v", err)

View File

@ -165,7 +165,7 @@ func jsonToUnstructured(stub, version, kind string) (*unstructured.Unstructured,
}
func namespaceLifecycleSetup(t *testing.T) (framework.CloseFunc, *namespace.NamespaceController, informers.SharedInformerFactory, clientset.Interface, dynamic.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}

View File

@ -75,7 +75,7 @@ func TestQuota(t *testing.T) {
admission.SetQuotaConfiguration(qca)
defer close(admissionCh)
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.AdmissionControl = admission
_, _, closeFn := framework.RunAnApiserverUsingServer(masterConfig, s, h)
defer closeFn()
@ -275,7 +275,7 @@ func TestQuotaLimitedResourceDenial(t *testing.T) {
admission.SetQuotaConfiguration(qca)
defer close(admissionCh)
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.AdmissionControl = admission
_, _, closeFn := framework.RunAnApiserverUsingServer(masterConfig, s, h)
defer closeFn()

View File

@ -118,7 +118,7 @@ func newMatchingPod(podName, namespace string) *v1.Pod {
}
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}
@ -140,7 +140,7 @@ func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.R
}
func rmSimpleSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}

View File

@ -111,7 +111,7 @@ func newMatchingPod(podName, namespace string) *v1.Pod {
}
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}

View File

@ -36,7 +36,7 @@ import (
func Test_ServiceLoadBalancerDisableAllocateNodePorts(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ServiceLBNodePortControl, true)()
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()
@ -80,7 +80,7 @@ func Test_ServiceLoadBalancerDisableAllocateNodePorts(t *testing.T) {
func Test_ServiceLoadBalancerEnableThenDisableAllocatedNodePorts(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ServiceLBNodePortControl, true)()
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, server, closeFn := framework.RunAMaster(masterConfig)
defer closeFn()

View File

@ -159,7 +159,7 @@ func newStatefulSetPVC(name string) v1.PersistentVolumeClaim {
// scSetup sets up necessities for Statefulset integration test, including master, apiserver, informers, and clientset
func scSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *statefulset.StatefulSetController, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}

View File

@ -62,7 +62,7 @@ func StartApiserver() (string, ShutdownFunc) {
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
}))
_, _, closeFn := framework.RunAnApiserverUsingServer(framework.NewIntegrationTestMasterConfig(), s, h)
_, _, closeFn := framework.RunAnApiserverUsingServer(framework.NewIntegrationTestControlPlaneConfig(), s, h)
shutdownFunc := func() {
klog.Infof("destroying API server")
@ -336,7 +336,7 @@ func InitTestMaster(t *testing.T, nsPrefix string, admission admission.Interface
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
}))
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
if admission != nil {
masterConfig.GenericConfig.AdmissionControl = admission

View File

@ -144,7 +144,7 @@ var defaultTimerConfig = attachdetach.TimerConfig{
// event is somehow missed by AttachDetach controller - it still
// gets cleaned up by Desired State of World populator.
func TestPodDeletionWithDswp(t *testing.T) {
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestMasterConfig())
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestControlPlaneConfig())
defer closeFn()
namespaceName := "test-pod-deletion"
node := &v1.Node{
@ -218,7 +218,7 @@ func initCSIObjects(stopCh chan struct{}, informers clientgoinformers.SharedInfo
}
func TestPodUpdateWithWithADC(t *testing.T) {
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestMasterConfig())
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestControlPlaneConfig())
defer closeFn()
namespaceName := "test-pod-update"
@ -287,7 +287,7 @@ func TestPodUpdateWithWithADC(t *testing.T) {
}
func TestPodUpdateWithKeepTerminatedPodVolumes(t *testing.T) {
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestMasterConfig())
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestControlPlaneConfig())
defer closeFn()
namespaceName := "test-pod-update"
@ -471,7 +471,7 @@ func createAdClients(ns *v1.Namespace, t *testing.T, server *httptest.Server, sy
// event is somehow missed by AttachDetach controller - it still
// gets added by Desired State of World populator.
func TestPodAddedByDswp(t *testing.T) {
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestMasterConfig())
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestControlPlaneConfig())
defer closeFn()
namespaceName := "test-pod-deletion"
@ -546,7 +546,7 @@ func TestPodAddedByDswp(t *testing.T) {
}
func TestPVCBoundWithADC(t *testing.T) {
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestMasterConfig())
_, server, closeFn := framework.RunAMaster(framework.NewIntegrationTestControlPlaneConfig())
defer closeFn()
namespaceName := "test-pod-deletion"

View File

@ -71,7 +71,7 @@ func initTestMaster(t *testing.T, nsPrefix string, admission admission.Interface
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
}))
masterConfig := framework.NewIntegrationTestMasterConfig()
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) {
resourceConfig.EnableVersions(schema.GroupVersion{