Browse Source

Fix SonarCube codesmell

Sebastian Gomez 4 years ago
parent
commit
2c6dde34f7
2 changed files with 18 additions and 8 deletions
  1. 9 4
      pkg/provider/ibm/provider_test.go
  2. 9 4
      pkg/provider/oracle/oracle_test.go

+ 9 - 4
pkg/provider/ibm/provider_test.go

@@ -46,6 +46,11 @@ type secretManagerTestCase struct {
 	expectedData map[string][]byte
 }
 
+const (
+	testSecret     = "test-secret"
+	defaultVersion = "default"
+)
+
 func makeValidSecretManagerTestCase() *secretManagerTestCase {
 	smtc := secretManagerTestCase{
 		mockClient:     &fakesm.IBMMockClient{},
@@ -65,16 +70,16 @@ func makeValidSecretManagerTestCase() *secretManagerTestCase {
 
 func makeValidRef() *esv1alpha1.ExternalSecretDataRemoteRef {
 	return &esv1alpha1.ExternalSecretDataRemoteRef{
-		Key:     "test-secret",
-		Version: "default",
+		Key:     testSecret,
+		Version: defaultVersion,
 	}
 }
 
 func makeValidRefFrom() *esv1alpha1.ExternalSecretDataFromRemoteRef {
 	return &esv1alpha1.ExternalSecretDataFromRemoteRef{
 		Extract: esv1alpha1.ExternalSecretExtract{
-			Key:     "test-secret",
-			Version: "default",
+			Key:     testSecret,
+			Version: defaultVersion,
 		},
 	}
 }

+ 9 - 4
pkg/provider/oracle/oracle_test.go

@@ -39,6 +39,11 @@ type vaultTestCase struct {
 	expectedData map[string][]byte
 }
 
+const (
+	testSecret     = "test-secret"
+	defaultVersion = "default"
+)
+
 func makeValidVaultTestCase() *vaultTestCase {
 	smtc := vaultTestCase{
 		mockClient:     &fakeoracle.OracleMockClient{},
@@ -57,16 +62,16 @@ func makeValidVaultTestCase() *vaultTestCase {
 
 func makeValidRef() *esv1alpha1.ExternalSecretDataRemoteRef {
 	return &esv1alpha1.ExternalSecretDataRemoteRef{
-		Key:     "test-secret",
-		Version: "default",
+		Key:     testSecret,
+		Version: defaultVersion,
 	}
 }
 
 func makeValidRefFrom() *esv1alpha1.ExternalSecretDataFromRemoteRef {
 	return &esv1alpha1.ExternalSecretDataFromRemoteRef{
 		Extract: esv1alpha1.ExternalSecretExtract{
-			Key:     "test-secret",
-			Version: "default",
+			Key:     testSecret,
+			Version: defaultVersion,
 		},
 	}
 }