Skip to content

Commit

Permalink
test(storage): fix emulated tests for metadata on read (#11387)
Browse files Browse the repository at this point in the history
  • Loading branch information
cojenco authored Jan 7, 2025
1 parent ff7ef8e commit a6eeac7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions storage/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ func TestOpenReaderEmulated(t *testing.T) {
})
}

func TestOpenReaderEmulated_Metadata(t *testing.T) {
transportClientTest(context.Background(), t, func(t *testing.T, ctx context.Context, project, bucket string, client storageClient) {
func TestOpenReaderMetadataEmulated(t *testing.T) {
transportClientTest(skipHTTP("metadata on read not supported in testbench rest server"), t, func(t *testing.T, ctx context.Context, project, bucket string, client storageClient) {
// Populate test data.
_, err := client.CreateBucket(ctx, project, bucket, &BucketAttrs{
Name: bucket,
Expand Down Expand Up @@ -849,8 +849,13 @@ func TestOpenReaderEmulated_Metadata(t *testing.T) {
"Custom-Key": "custom-value",
"Some-Other-Key": "some-other-value",
}
if diff := cmp.Diff(r.Metadata(), expectedMetadata); diff != "" {
t.Fatalf("Object Metadata: got(-),want(+):\n%s", diff)
gotMetaData := r.Metadata()
// Testbench specific metadata is included for testing purposes.
for key, expectedValue := range expectedMetadata {
actualValue, ok := gotMetaData[key]
if !ok || actualValue != expectedValue {
t.Fatalf("Object Metadata: Expected key %q with value %q, but got %q", key, expectedValue, actualValue)
}
}

})
Expand Down

0 comments on commit a6eeac7

Please sign in to comment.