Browse Source

Fixed lint issues

Sebastian Gomez 4 years ago
parent
commit
0cc03caae4

+ 6 - 2
e2e/suite/aws/secretsmanager.go

@@ -101,13 +101,17 @@ var _ = Describe("[aws] ", func() {
 			{
 				SecretKey: secretKey1,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: secretKey1,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: secretKey1,
+					},
 				},
 			},
 			{
 				SecretKey: secretKey2,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: secretKey2,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: secretKey2,
+					},
 				},
 			},
 		}

+ 55 - 25
e2e/suite/common/common.go

@@ -52,13 +52,17 @@ func SimpleDataSync(f *framework.Framework) (string, func(*framework.TestCase))
 			{
 				SecretKey: secretKey1,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: secretKey1,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: secretKey1,
+					},
 				},
 			},
 			{
 				SecretKey: secretKey2,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: secretKey2,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: secretKey2,
+					},
 				},
 			},
 		}
@@ -85,7 +89,9 @@ func SyncWithoutTargetName(f *framework.Framework) (string, func(*framework.Test
 			{
 				SecretKey: secretKey1,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: secretKey1,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: secretKey1,
+					},
 				},
 			},
 		}
@@ -115,15 +121,19 @@ func JSONDataWithProperty(f *framework.Framework) (string, func(*framework.TestC
 			{
 				SecretKey: secretKey1,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey1,
-					Property: "foo1",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey1,
+						Property: "foo1",
+					},
 				},
 			},
 			{
 				SecretKey: secretKey2,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey2,
-					Property: "bar2",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey2,
+						Property: "bar2",
+					},
 				},
 			},
 		}
@@ -150,8 +160,10 @@ func JSONDataWithoutTargetName(f *framework.Framework) (string, func(*framework.
 			{
 				SecretKey: secretKey,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey,
-					Property: "foo",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey,
+						Property: "foo",
+					},
 				},
 			},
 		}
@@ -201,15 +213,19 @@ func JSONDataWithTemplate(f *framework.Framework) (string, func(*framework.TestC
 			{
 				SecretKey: "one",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey1,
-					Property: "foo1",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey1,
+						Property: "foo1",
+					},
 				},
 			},
 			{
 				SecretKey: "two",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey2,
-					Property: "bar2",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey2,
+						Property: "bar2",
+					},
 				},
 			},
 		}
@@ -237,7 +253,9 @@ func JSONDataFromSync(f *framework.Framework) (string, func(*framework.TestCase)
 		}
 		tc.ExternalSecret.Spec.DataFrom = []esv1alpha1.ExternalSecretDataRemoteRef{
 			{
-				Key: secretKey1,
+				Extract: esv1alpha1.ExternalSecretExtract{
+					Key: secretKey1,
+				},
 			},
 		}
 	}
@@ -277,15 +295,19 @@ func NestedJSONWithGJSON(f *framework.Framework) (string, func(*framework.TestCa
 			{
 				SecretKey: targetSecretKey1,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey1,
-					Property: "name.first",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey1,
+						Property: "name.first",
+					},
 				},
 			},
 			{
 				SecretKey: targetSecretKey2,
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      secretKey1,
-					Property: "friends.1.first",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      secretKey1,
+						Property: "friends.1.first",
+					},
 				},
 			},
 		}
@@ -315,8 +337,10 @@ func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)
 			{
 				SecretKey: "mysecret",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      cloudSecretName,
-					Property: "dockerconfig",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      cloudSecretName,
+						Property: "dockerconfig",
+					},
 				},
 			},
 		}
@@ -353,8 +377,10 @@ func DataPropertyDockerconfigJSON(f *framework.Framework) (string, func(*framewo
 			{
 				SecretKey: "mysecret",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      cloudSecretName,
-					Property: "dockerconfig",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      cloudSecretName,
+						Property: "dockerconfig",
+					},
 				},
 			},
 		}
@@ -427,7 +453,9 @@ func SSHKeySync(f *framework.Framework) (string, func(*framework.TestCase)) {
 			{
 				SecretKey: "mysecret",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: sshSecretName,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: sshSecretName,
+					},
 				},
 			},
 		}
@@ -499,8 +527,10 @@ func SSHKeySyncDataProperty(f *framework.Framework) (string, func(*framework.Tes
 			{
 				SecretKey: "mysecret",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key:      cloudSecretName,
-					Property: "ssh-auth",
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key:      cloudSecretName,
+						Property: "ssh-auth",
+					},
 				},
 			},
 		}

+ 3 - 1
e2e/suite/gcp/gcp.go

@@ -130,7 +130,9 @@ x6HaRh+EUwU51von6M9lEF9/p5Q=
 			{
 				SecretKey: "mysecret",
 				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
-					Key: cloudSecretName,
+					Extract: esv1alpha1.ExternalSecretExtract{
+						Key: cloudSecretName,
+					},
 				},
 			},
 		}

+ 1 - 1
pkg/provider/alibaba/kms.go

@@ -142,7 +142,7 @@ func (kms *KeyManagementService) GetSecret(ctx context.Context, ref esv1alpha1.E
 
 // Implements store.Client.GetAllSecrets Interface.
 // New version of GetAllSecrets.
-func (a *KeyManagementService) GetAllSecrets(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) (map[string][]byte, error) {
+func (kms *KeyManagementService) GetAllSecrets(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) (map[string][]byte, error) {
 	// TO be implemented
 	return map[string][]byte{}, nil
 }

+ 5 - 5
pkg/provider/azure/keyvault/keyvault_test.go

@@ -161,6 +161,7 @@ const (
 	jsonSingleTestString = `{"Name": "External", "LastName": "Secret" }`
 	keyName              = "key/keyname"
 	certName             = "cert/certname"
+	secretString         = "changedvalue"
 )
 
 func newKVJWK(b []byte) *keyvault.JSONWebKey {
@@ -175,7 +176,7 @@ func newKVJWK(b []byte) *keyvault.JSONWebKey {
 // test the sm<->azurekv interface
 // make sure correct values are passed and errors are handled accordingly.
 func TestAzureKeyVaultSecretManagerGetSecret(t *testing.T) {
-	secretString := "changedvalue"
+	secretString := secretString
 	secretCertificate := "certificate_value"
 
 	// good case
@@ -287,7 +288,7 @@ func TestAzureKeyVaultSecretManagerGetSecret(t *testing.T) {
 }
 
 func TestAzureKeyVaultSecretManagerGetSecretMap(t *testing.T) {
-	secretString := "changedvalue"
+	secretString := secretString
 	secretCertificate := "certificate_value"
 
 	badSecretString := func(smtc *secretManagerTestCase) {
@@ -381,7 +382,7 @@ func TestAzureKeyVaultSecretManagerGetSecretMap(t *testing.T) {
 }
 
 func TestAzureKeyVaultSecretManagerGetAllSecrets(t *testing.T) {
-	secretString := "changedvalue"
+	secretString := secretString
 	secretName := "example-1"
 	wrongName := "not-valid"
 	environment := "dev"
@@ -440,8 +441,7 @@ func TestAzureKeyVaultSecretManagerGetAllSecrets(t *testing.T) {
 		}
 
 		secretList := make([]keyvault.SecretItem, 1)
-		secretList = append(secretList, secretItemOne)
-		secretList = append(secretList, secretItemTwo)
+		secretList = append(secretList, secretItemOne, secretItemTwo)
 
 		list := keyvault.SecretListResult{
 			Value: &secretList,

+ 1 - 1
pkg/provider/webhook/webhook.go

@@ -375,7 +375,7 @@ func (w *WebHook) getCertFromConfigMap(provider *esv1alpha1.WebhookProvider) ([]
 
 // Implements store.Client.GetAllSecrets Interface.
 // New version of GetAllSecrets.
-func (sm *WebHook) GetAllSecrets(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) (map[string][]byte, error) {
+func (w *WebHook) GetAllSecrets(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) (map[string][]byte, error) {
 	// TO be implemented
 	return map[string][]byte{}, nil
 }