From 06182a344340758d9d4f499ac5808d1193f9600a Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 4 Jul 2022 09:41:46 +0100 Subject: [PATCH] s3: actually compress the payload for content-type gzip test --- backend/s3/s3_internal_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/s3/s3_internal_test.go b/backend/s3/s3_internal_test.go index ecd39f41f..2568968d6 100644 --- a/backend/s3/s3_internal_test.go +++ b/backend/s3/s3_internal_test.go @@ -1,6 +1,8 @@ package s3 import ( + "bytes" + "compress/gzip" "context" "fmt" "testing" @@ -14,9 +16,20 @@ import ( "github.com/stretchr/testify/require" ) +func gz(t *testing.T, s string) string { + var buf bytes.Buffer + zw := gzip.NewWriter(&buf) + _, err := zw.Write([]byte(s)) + require.NoError(t, err) + err = zw.Close() + require.NoError(t, err) + return buf.String() +} + func (f *Fs) InternalTestMetadata(t *testing.T) { ctx := context.Background() - contents := random.String(100) + contents := gz(t, random.String(1000)) + item := fstest.NewItem("test-metadata", contents, fstest.Time("2001-05-06T04:05:06.499999999Z")) btime := time.Now() metadata := fs.Metadata{