Skip to content

Commit 1166c6b

Browse files
test: update Parameter Store integration test to match new Upload behavior
- Update TestAWSParameterStoreDestination_EncryptedFile_Integration to test NotImplementedError - Remove test of legacy Upload functionality that's not used by publish command - Verify Upload method now returns NotImplementedError consistently with other destinations - All integration tests pass with real AWS credentials The publish command uses UploadUnencrypted for Parameter Store, so Upload method should return NotImplementedError like Vault and Secrets Manager destinations.
1 parent f805e48 commit 1166c6b

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

publish/aws_integration_test.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,10 @@ func TestAWSParameterStoreDestination_EncryptedFile_Integration(t *testing.T) {
211211
t.Skip("Skipping integration test: SOPS_TEST_AWS_PARAMETER_NAME not set")
212212
}
213213

214-
ctx := context.Background()
215214
dest := NewAWSParameterStoreDestination(testAWSRegion, testParameterName+"-file", testParameterType)
216215

217-
// Test encrypted file content (testing Upload method directly)
218-
// Note: The publish command now uses UploadUnencrypted for decrypted JSON
216+
// Test that Upload method returns NotImplementedError (consistent with Vault/Secrets Manager)
217+
// The publish command uses UploadUnencrypted for Parameter Store, not Upload
219218
encryptedContent := []byte(`# SOPS encrypted file
220219
database:
221220
host: ENC[AES256_GCM,data:xyz123,type:str]
@@ -225,20 +224,9 @@ sops:
225224
- arn: arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
226225
version: 3.8.1`)
227226

228-
// Upload encrypted file content
227+
// Upload should return NotImplementedError
229228
err := dest.Upload(encryptedContent, "encrypted-test")
230-
require.NoError(t, err, "Failed to upload encrypted file to Parameter Store")
231-
232-
// Verify the file was stored as-is
233-
cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(testAWSRegion))
234-
require.NoError(t, err, "Failed to load AWS config")
235-
236-
client := ssm.NewFromConfig(cfg)
237-
result, err := client.GetParameter(ctx, &ssm.GetParameterInput{
238-
Name: aws.String(testParameterName + "-file"),
239-
WithDecryption: aws.Bool(true),
240-
})
241-
require.NoError(t, err, "Failed to retrieve parameter from Parameter Store")
242-
243-
assert.Equal(t, string(encryptedContent), *result.Parameter.Value, "Stored file content doesn't match original")
229+
require.NotNil(t, err, "Upload should return an error")
230+
assert.IsType(t, &NotImplementedError{}, err, "Should return NotImplementedError")
231+
assert.Contains(t, err.Error(), "AWS Parameter Store does not support uploading encrypted sops files directly")
244232
}

0 commit comments

Comments
 (0)