-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3zip_test.go
51 lines (40 loc) · 991 Bytes
/
s3zip_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package s3zip
import (
"fmt"
"testing"
"github.com/aws/aws-sdk-go/aws/session"
)
func TestNew(t *testing.T) {
sess := session.New()
t.Run("without config options", func(t *testing.T) {
z := New(sess)
if z.uploader == nil {
t.Error("expected to have an uploader")
}
if z.uploader == nil {
t.Error("expected to have a downloader")
}
if z.concurrency != 1 {
t.Errorf("expected concurrency to be %d, got %d", 1, z.concurrency)
}
})
t.Run("with config options", func(t *testing.T) {
z := New(sess,
WithConcurrency(42),
)
if z.concurrency != 42 {
t.Errorf("expected concurrency to be %d, got %d", 42, z.concurrency)
}
})
}
func TestWithConcurrency(t *testing.T) {
z := New(session.New())
for _, c := range []int{4, 2, 42} {
t.Run(fmt.Sprintf("WithConcurrency(%d)", c), func(t *testing.T) {
WithConcurrency(c)(&z)
if z.concurrency != c {
t.Errorf("expected to change concurrency to %d, got %d", c, z.concurrency)
}
})
}
}