-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhelper_test.go
62 lines (53 loc) · 1.34 KB
/
helper_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
package bqwt
import (
"context"
"github.com/stretchr/testify/assert"
_ "github.com/viant/bgc"
"github.com/viant/dsunit"
"testing"
"time"
)
func TestGetTableInfo(t *testing.T) {
ctx := context.Background()
if dsunit.InitFromURL(t, "test/config/init.yaml") {
if !dsunit.PrepareFor(t, "testdb", "test/data", "get_table_info") {
return
}
}
request := &Request{
DatasetID: "viant-e2e:testdb",
StorageRegion: "viant-e2e.us-region",
}
info, err := GetTablesInfo(ctx, request, false)
assert.Nil(t, err)
if !assert.True(t, len(info) > 0) {
return
}
assert.Equal(t, "dummy", info[0].TableID)
assert.Equal(t, "testdb", info[0].DatasetID)
}
func TestGetTableInfoLastModified(t *testing.T) {
ctx := context.Background()
request := &Request{
DatasetID: "viant-e2e:testdb",
StorageRegion: "viant-e2e.us-region",
}
if dsunit.InitFromURL(t, "test/config/init.yaml") {
if !dsunit.PrepareFor(t, "testdb", "test/data", "get_table_info") {
return
}
}
time.Sleep(1 * time.Second)
if dsunit.InitFromURL(t, "test/config/init2.yaml") {
if !dsunit.PrepareFor(t, "testdb", "test/data", "get_table_info2") {
return
}
}
info, err := GetTablesInfo(ctx, request, false)
assert.Nil(t, err)
if !assert.True(t, len(info) == 1) {
return
}
assert.Equal(t, "dummy2", info[0].TableID)
assert.Equal(t, "testdb", info[0].DatasetID)
}