Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Protasio <approtas@amazon.com>
  • Loading branch information
alanprot committed Jul 6, 2022
1 parent 55df13d commit 2d5c73a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/objstore/objstore_test.go
Expand Up @@ -7,6 +7,7 @@ import (
"bytes"
"context"
"io"
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -92,6 +93,20 @@ func TestTracingReader(t *testing.T) {
testutil.Equals(t, int64(11), size)
}

func TestDownloadDirConcurrency(t *testing.T) {
m := BucketWithMetrics("", NewInMemBucket(), nil)
tempDir := t.TempDir()

testutil.Ok(t, m.Upload(context.Background(), "dir/obj1", bytes.NewReader([]byte("1"))))
testutil.Ok(t, m.Upload(context.Background(), "dir/obj2", bytes.NewReader([]byte("2"))))
testutil.Ok(t, m.Upload(context.Background(), "dir/obj3", bytes.NewReader([]byte("3"))))

testutil.Ok(t, DownloadDir(context.Background(), log.NewNopLogger(), m, "dir/", "dir/", tempDir, WithFetchConcurrency(10)))
i, err := ioutil.ReadDir(tempDir)
testutil.Ok(t, err)
testutil.Assert(t, len(i) == 3)
}

func TestTimingTracingReader(t *testing.T) {
m := BucketWithMetrics("", NewInMemBucket(), nil)
r := bytes.NewReader([]byte("hello world"))
Expand Down

0 comments on commit 2d5c73a

Please sign in to comment.