Skip to content

Commit

Permalink
Add integration test case for flex checksum (#2967)
Browse files Browse the repository at this point in the history
* add checksum test case where checksum is required without algo member

* add changelog

* update test comment

* update test log
  • Loading branch information
wty-Bryant authored Jan 16, 2025
1 parent c578cdd commit 7ea97e5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changelog/dac44b16ae46483da9126a7088225e04.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "dac44b16-ae46-483d-a912-6a7088225e04",
"type": "bugfix",
"description": "Add s3 checksum integration test case where operations require checksum but do not have input algorithm setting",
"modules": [
"service/internal/integrationtest"
]
}
32 changes: 32 additions & 0 deletions service/internal/integrationtest/s3/checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,38 @@ func TestInteg_RequireChecksum(t *testing.T) {
}
}

func TestInteg_RequireChecksumWithoutRequestAlgorithmMember(t *testing.T) {
params := &s3.PutBucketOwnershipControlsInput{
Bucket: &setupMetadata.Buckets.Source.Name,
OwnershipControls: &types.OwnershipControls{
Rules: []types.OwnershipControlsRule{
{
ObjectOwnership: types.ObjectOwnershipBucketOwnerPreferred,
},
},
},
}

t.Logf("putting bucket ownership control: %q", *params.Bucket)
result, err := s3client.PutBucketOwnershipControls(context.Background(), params)
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
computedChecksums, ok := s3.GetComputedInputChecksumsMetadata(result.ResultMetadata)
if !ok {
t.Fatalf("expect computed checksums metadata present, got %q", result)
}

expectComputedChecksums := s3.ComputedInputChecksumsMetadata{
ComputedChecksums: map[string]string{
"CRC32": "cK9COg==",
},
}
if diff := cmpDiff(expectComputedChecksums, computedChecksums); diff != "" {
t.Errorf("expect computed checksum metadata match: %s\n", diff)
}
}

func bufferLogger(t *testing.T) (logging.Logger, *bytes.Buffer) {
var logged bytes.Buffer

Expand Down

0 comments on commit 7ea97e5

Please sign in to comment.