mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 00:43:49 +01:00
s3: actually compress the payload for content-type gzip test
This commit is contained in:
parent
a58b482061
commit
06182a3443
@ -1,6 +1,8 @@
|
|||||||
package s3
|
package s3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
@ -14,9 +16,20 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func (f *Fs) InternalTestMetadata(t *testing.T) {
|
||||||
ctx := context.Background()
|
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"))
|
item := fstest.NewItem("test-metadata", contents, fstest.Time("2001-05-06T04:05:06.499999999Z"))
|
||||||
btime := time.Now()
|
btime := time.Now()
|
||||||
metadata := fs.Metadata{
|
metadata := fs.Metadata{
|
||||||
|
Loading…
Reference in New Issue
Block a user