forked from segmentio/go-athena
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontext_test.go
72 lines (69 loc) · 1.3 KB
/
context_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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package athena
import (
"context"
"testing"
)
func Test_getCatalog(t *testing.T) {
tests := []struct {
name string
ctx context.Context
want string
want1 bool
}{
{
name: "Default",
ctx: context.Background(),
want: "",
want1: false,
},
{
name: "SetCatalog",
ctx: SetCatalog(context.Background(), "test_catalog"),
want: "test_catalog",
want1: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, got1 := getCatalog(tt.ctx)
if got != tt.want {
t.Errorf("getCatalog() got = %v, want %v", got, tt.want)
}
if got1 != tt.want1 {
t.Errorf("getCatalog() got1 = %v, want %v", got1, tt.want1)
}
})
}
}
func Test_getTimeout(t *testing.T) {
tests := []struct {
name string
ctx context.Context
want uint
want1 bool
}{
{
name: "Default",
ctx: context.Background(),
want: 0,
want1: false,
},
{
name: "SetTimeout",
ctx: SetTimeout(context.Background(), 100),
want: 100,
want1: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, got1 := getTimeout(tt.ctx)
if got != tt.want {
t.Errorf("getTimeout() got = %v, want %v", got, tt.want)
}
if got1 != tt.want1 {
t.Errorf("getTimeout() got1 = %v, want %v", got1, tt.want1)
}
})
}
}