Part3: master to controlplane in test/integration

Rename RunAMaster to RunAControlPlane
This commit is contained in:
Mengjiao Liu
2021-05-25 16:10:48 +08:00
parent 2cefcc6be7
commit 387154f1a9
43 changed files with 113 additions and 113 deletions

View File

@@ -58,7 +58,7 @@ func TestSubjectAccessReview(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
@@ -153,7 +153,7 @@ func TestSelfSubjectAccessReview(t *testing.T) {
}, true, nil
})
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
@@ -232,7 +232,7 @@ func TestLocalSubjectAccessReview(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})

View File

@@ -441,7 +441,7 @@ func getTestRequests(namespace string) []struct {
func TestAuthModeAlwaysAllow(t *testing.T) {
// Set up a master
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-always-allow", s, t)
@@ -539,7 +539,7 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
// Set up a master
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-always-deny", s, t)
@@ -589,7 +589,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-alice-not-forbidden", s, t)
@@ -658,7 +658,7 @@ func TestBobIsForbidden(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-bob-forbidden", s, t)
@@ -702,7 +702,7 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-unknown-unauthorized", s, t)
@@ -764,7 +764,7 @@ func TestImpersonateIsForbidden(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = impersonateAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-impersonate-forbidden", s, t)
@@ -911,7 +911,7 @@ func TestAuthorizationAttributeDetermination(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = trackingAuthorizer
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-attribute-determination", s, t)
@@ -977,7 +977,7 @@ func TestNamespaceAuthorization(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = a
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-namespace", s, t)
@@ -1075,7 +1075,7 @@ func TestKindAuthorization(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = a
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-kind", s, t)
@@ -1159,7 +1159,7 @@ func TestReadOnlyAuthorization(t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
masterConfig.GenericConfig.Authorization.Authorizer = a
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-read-only", s, t)
@@ -1236,7 +1236,7 @@ func testWebhookTokenAuthenticator(customDialer bool, t *testing.T) {
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-webhook-token", s, t)

View File

@@ -119,7 +119,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
// Set up a master
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
ns := framework.CreateTestingNamespace("auth-bootstrap-token", s, t)

View File

@@ -535,7 +535,7 @@ func TestRBAC(t *testing.T) {
"user-with-no-permissions": {Name: "user-with-no-permissions"},
}))
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
clientConfig := &restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{NegotiatedSerializer: legacyscheme.Codecs}}
@@ -647,7 +647,7 @@ func TestBootstrapping(t *testing.T) {
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
superUser: {Name: "admin", Groups: []string{"system:masters"}},
}))
_, s, closeFn := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
clientset := clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
@@ -708,7 +708,7 @@ func TestDiscoveryUpgradeBootstrapping(t *testing.T) {
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
superUser: {Name: "admin", Groups: []string{"system:masters"}},
}))
_, s, tearDownFn := framework.RunAMaster(masterConfig)
_, s, tearDownFn := framework.RunAnAPIServer(masterConfig)
client := clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
@@ -752,7 +752,7 @@ func TestDiscoveryUpgradeBootstrapping(t *testing.T) {
// Check that upgraded API servers inherit `system:public-info-viewer` settings from
// `system:discovery`, and respect auto-reconciliation annotations.
_, s, tearDownFn = framework.RunAMaster(masterConfig)
_, s, tearDownFn = framework.RunAnAPIServer(masterConfig)
client = clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})

View File

@@ -119,7 +119,7 @@ func TestServiceAccountTokenCreate(t *testing.T) {
masterConfig.ExtraConfig.ServiceAccountJWKSURI = ""
masterConfig.ExtraConfig.ServiceAccountPublicKeys = []interface{}{&pk}
master, _, closeFn := framework.RunAMaster(masterConfig)
master, _, closeFn := framework.RunAnAPIServer(masterConfig)
defer closeFn()
cs, err := clientset.NewForConfig(master.GenericAPIServer.LoopbackClientConfig)