зеркало из https://github.com/Azure/ARO-RP.git
Renames SP checker fields
This commit is contained in:
Родитель
2268445408
Коммит
6c066e5902
|
@ -22,8 +22,8 @@ type servicePrincipalChecker interface {
|
|||
type checker struct {
|
||||
log *logrus.Entry
|
||||
|
||||
credentialsGetter func(ctx context.Context) (*clusterauthorizer.Credentials, error)
|
||||
spValidatorConstructor func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error)
|
||||
credentials func(ctx context.Context) (*clusterauthorizer.Credentials, error)
|
||||
newSPValidator func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error)
|
||||
}
|
||||
|
||||
func newServicePrincipalChecker(log *logrus.Entry, kubernetescli kubernetes.Interface) servicePrincipalChecker {
|
||||
|
@ -32,10 +32,10 @@ func newServicePrincipalChecker(log *logrus.Entry, kubernetescli kubernetes.Inte
|
|||
return &checker{
|
||||
log: log,
|
||||
|
||||
credentialsGetter: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
||||
credentials: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
||||
return clusterauthorizer.AzCredentials(ctx, kubernetescli)
|
||||
},
|
||||
spValidatorConstructor: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
||||
newSPValidator: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
||||
return dynamic.NewServicePrincipalValidator(log, azEnv, dynamic.AuthorizerClusterServicePrincipal, tokenClient)
|
||||
},
|
||||
}
|
||||
|
@ -47,12 +47,12 @@ func (r *checker) Check(ctx context.Context, AZEnvironment string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
azCred, err := r.credentialsGetter(ctx)
|
||||
azCred, err := r.credentials(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
spDynamic, err := r.spValidatorConstructor(&azEnv)
|
||||
spDynamic, err := r.newSPValidator(&azEnv)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -74,13 +74,13 @@ func TestCheck(t *testing.T) {
|
|||
|
||||
sp := &checker{
|
||||
log: log,
|
||||
credentialsGetter: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
||||
credentials: func(ctx context.Context) (*clusterauthorizer.Credentials, error) {
|
||||
if tt.credentialsExist {
|
||||
return mockCredentials, nil
|
||||
}
|
||||
return nil, errors.New("fake credentials get error")
|
||||
},
|
||||
spValidatorConstructor: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
||||
newSPValidator: func(azEnv *azureclient.AROEnvironment) (dynamic.ServicePrincipalValidator, error) {
|
||||
if validatorMock != nil {
|
||||
return validatorMock, nil
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче