| 36 | } |
| 37 | |
| 38 | func testBucket(t *testing.T, conf config.BlobConfig) { |
| 39 | a := assertions.New(t) |
| 40 | ctx := test.Context() |
| 41 | |
| 42 | bucket, err := conf.Bucket(ctx, bucketName(), test.HTTPClientProvider) |
| 43 | if !a.So(err, should.BeNil) { |
| 44 | t.Errorf("Failed to create bucket: %v", err) |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | now := time.Now().Format(time.RFC3339) |
| 49 | |
| 50 | contents := []byte(now) |
| 51 | err = bucket.WriteAll(ctx, "path/to/file", contents, WriterOptions("text/plain", "key", "value")) |
| 52 | if !a.So(err, should.BeNil) { |
| 53 | t.Errorf("Failed to write contents: %v", err) |
| 54 | return |
| 55 | } |
| 56 | |
| 57 | res, err := bucket.ReadAll(ctx, "path/to/file") |
| 58 | if !a.So(err, should.BeNil) { |
| 59 | t.Errorf("Failed to read contents: %v", err) |
| 60 | return |
| 61 | } |
| 62 | a.So(res, should.Resemble, contents) |
| 63 | } |
| 64 | |
| 65 | func TestLocal(t *testing.T) { |
| 66 | a := assertions.New(t) |