Skip to content

Commit

Permalink
storagetesting: verify progress callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowalski committed Oct 27, 2018
1 parent 0eded38 commit 4237bbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/storagetesting/verify.go
Expand Up @@ -27,9 +27,13 @@ func VerifyStorage(ctx context.Context, t *testing.T, r storage.Storage) {
AssertGetBlockNotFound(ctx, t, r, b.blk)
}

ctx2 := storage.WithUploadProgressCallback(ctx, func(desc string, completed, total int64) {
log.Infof("progress %v: %v/%v", desc, completed, total)
})

// Now add blocks.
for _, b := range blocks {
if err := r.PutBlock(ctx, b.blk, b.contents); err != nil {
if err := r.PutBlock(ctx2, b.blk, b.contents); err != nil {
t.Errorf("can't put block: %v", err)
}

Expand Down
2 changes: 2 additions & 0 deletions storage/gcs/gcs_storage_test.go
Expand Up @@ -34,4 +34,6 @@ func TestGCSStorage(t *testing.T) {
}

storagetesting.VerifyStorage(ctx, t, st)
storagetesting.AssertConnectionInfoRoundTrips(ctx, t, st)

}

0 comments on commit 4237bbc

Please sign in to comment.