Explorar o código

Revert "WIP: Setsecret fails if no data is provided"

This reverts commit a0c08f3c286e9cd797c6674827fad238891fb9da.
Adrienne Galloway %!s(int64=4) %!d(string=hai) anos
pai
achega
420cb7a86f

+ 1 - 1
e2e/suites/provider/cases/akeyless/provider.go

@@ -180,7 +180,7 @@ func (a *akeylessProvider) GetToken() (string, error) {
 	} else {
 	} else {
 		cloudID, err := a.getCloudID(a.accessType, a.accessTypeParam)
 		cloudID, err := a.getCloudID(a.accessType, a.accessTypeParam)
 		if err != nil {
 		if err != nil {
-			return "", errors.New("Require Cloud ID " + err.Error())
+			return "", fmt.Errorf("Require Cloud ID " + err.Error())
 		}
 		}
 		authBody.AccessType = akeyless.PtrString(a.accessType)
 		authBody.AccessType = akeyless.PtrString(a.accessType)
 		authBody.CloudId = akeyless.PtrString(cloudID)
 		authBody.CloudId = akeyless.PtrString(cloudID)

+ 1 - 1
pkg/provider/akeyless/akeyless_api.go

@@ -52,7 +52,7 @@ func (a *akeylessBase) GetToken(accessID, accType, accTypeParam string) (string,
 	} else {
 	} else {
 		cloudID, err := a.getCloudID(accType, accTypeParam)
 		cloudID, err := a.getCloudID(accType, accTypeParam)
 		if err != nil {
 		if err != nil {
-			return "", errors.New("Require Cloud ID " + err.Error())
+			return "", fmt.Errorf("Require Cloud ID " + err.Error())
 		}
 		}
 		authBody.AccessType = akeyless.PtrString(accType)
 		authBody.AccessType = akeyless.PtrString(accType)
 		authBody.CloudId = akeyless.PtrString(cloudID)
 		authBody.CloudId = akeyless.PtrString(cloudID)

+ 1 - 1
pkg/provider/gcp/secretmanager/secretsmanager.go

@@ -280,7 +280,7 @@ func (sm *ProviderGCP) SetSecret(ctx context.Context, payload []byte, remoteRef
 		}
 		}
 	}
 	}
 
 
-	if gcpVersion != nil && gcpVersion.Payload != nil && bytes.Equal(payload, gcpVersion.Payload.Data) {
+	if gcpVersion != nil && gcpVersion.Payload != nil && string(payload) == string(gcpVersion.Payload.Data) {
 		return nil
 		return nil
 	}
 	}
 
 

+ 1 - 1
pkg/provider/senhasegura/dsm/dsm.go

@@ -177,7 +177,7 @@ func (dsm *DSM) FetchSecrets() (respObj IsoDappResponse, err error) {
 
 
 	client := &http.Client{Transport: tr}
 	client := &http.Client{Transport: tr}
 
 
-	r, err := http.NewRequest("GET", u.String(), http.NewRequest("GET", u.String(), http.NoBody))
+	r, err := http.NewRequest("GET", u.String(), nil)
 	if err != nil {
 	if err != nil {
 		return respObj, errCannotCreateRequest
 		return respObj, errCannotCreateRequest
 	}
 	}

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

@@ -374,7 +374,7 @@ func (v *client) SetSecret(ctx context.Context, value []byte, remoteRef esv1beta
 		return err
 		return err
 	}
 	}
 	// This is the address of our vault on our local cluster
 	// This is the address of our vault on our local cluster
-	// cfg.Address = "vault.vault-ns.svc.cluster.local.8200"
+	//cfg.Address = "vault.vault-ns.svc.cluster.local.8200"
 
 
 	return nil
 	return nil
 }
 }

+ 0 - 4
pkg/provider/vault/vault_test.go

@@ -1420,10 +1420,6 @@ func TestSetSecret(t *testing.T) {
 	}
 	}
 	ref := fakeRef{key: "I'm a key"}
 	ref := fakeRef{key: "I'm a key"}
 	err := client.SetSecret(context.Background(), []byte("HI"), ref)
 	err := client.SetSecret(context.Background(), []byte("HI"), ref)
-
-	secretData := map[string]interface{}{}
-	_, noDataClient := client.logical.WriteWithContext(context.TODO(), path, secretData)
 	
 	
-	assert.Equal(t, noDataClient, nil)
 	assert.Equal(t, err, nil)
 	assert.Equal(t, err, nil)
 }
 }

+ 2 - 2
pkg/provider/yandex/certificatemanager/certificatemanager_test.go

@@ -170,7 +170,7 @@ func TestGetSecretWithProperty(t *testing.T) {
 	tassert.Nil(t, err)
 	tassert.Nil(t, err)
 	tassert.Equal(
 	tassert.Equal(
 		t,
 		t,
-		strings.TrimSpace(certificate1 + "\n" + certificate2),
+		strings.TrimSpace(strings.Join([]string{certificate1, certificate2}, "\n")),
 		strings.TrimSpace(string(chainData)),
 		strings.TrimSpace(string(chainData)),
 	)
 	)
 
 
@@ -576,7 +576,7 @@ func TestGetSecretMap(t *testing.T) {
 	tassert.Equal(
 	tassert.Equal(
 		t,
 		t,
 		map[string][]byte{
 		map[string][]byte{
-			chainProperty:      []byte(certificate1 + "\n" + certificate2),
+			chainProperty:      []byte(strings.Join([]string{certificate1, certificate2}, "\n")),
 			privateKeyProperty: []byte(privateKey),
 			privateKeyProperty: []byte(privateKey),
 		},
 		},
 		data,
 		data,