(t *testing.T)
| 170 | } |
| 171 | |
| 172 | func (f *Fs) testGzipEncoding(t *testing.T) { |
| 173 | ctx := context.Background() |
| 174 | original := random.String(1000) |
| 175 | contents := gz(t, original) |
| 176 | |
| 177 | item := fstest.NewItem("test-gzip", contents, fstest.Time("2001-05-06T04:05:06.499999999Z")) |
| 178 | metadata := fs.Metadata{ |
| 179 | "content-encoding": "gzip", |
| 180 | "content-type": "text/plain", |
| 181 | } |
| 182 | obj := fstests.PutTestContentsMetadata(ctx, t, f, &item, true, contents, true, "text/html", metadata) |
| 183 | defer func() { |
| 184 | assert.NoError(t, obj.Remove(ctx)) |
| 185 | }() |
| 186 | o := obj.(*Object) |
| 187 | |
| 188 | // Test that the gzipped file we uploaded can be |
| 189 | // downloaded with and without decompression |
| 190 | checkDownload := func(wantContents string, wantSize int64, wantHash string) { |
| 191 | gotContents := fstests.ReadObject(ctx, t, o, -1) |
| 192 | assert.Equal(t, wantContents, gotContents) |
| 193 | assert.Equal(t, wantSize, o.Size()) |
| 194 | gotHash, err := o.Hash(ctx, hash.MD5) |
| 195 | require.NoError(t, err) |
| 196 | assert.Equal(t, wantHash, gotHash) |
| 197 | } |
| 198 | |
| 199 | t.Run("NoDecompress", func(t *testing.T) { |
| 200 | checkDownload(contents, int64(len(contents)), md5sum(t, contents)) |
| 201 | }) |
| 202 | t.Run("Decompress", func(t *testing.T) { |
| 203 | f.opt.Decompress = true |
| 204 | defer func() { |
| 205 | f.opt.Decompress = false |
| 206 | }() |
| 207 | checkDownload(original, -1, "") |
| 208 | }) |
| 209 | } |
| 210 | |
| 211 | func (f *Fs) InternalTest(t *testing.T) { |
| 212 | t.Run("Features", f.testFeatures) |
nothing calls this directly
no test coverage detected