-
Notifications
You must be signed in to change notification settings - Fork 0
/
bqload_service_test.go
50 lines (41 loc) · 1.05 KB
/
bqload_service_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
package main
import (
"context"
"testing"
"github.com/google/uuid"
"go.mercari.io/datastore"
"go.mercari.io/datastore/clouddatastore"
)
func TestBQLoadService_InsertBigQueryLoadJob(t *testing.T) {
t.SkipNow() // 実際にDatastore APIを実行するので、普段はSkipする
ctx := context.Background()
ds, err := clouddatastore.FromContext(ctx, datastore.WithProjectID(uuid.New().String()))
if err != nil {
t.Fatal(err)
}
s, err := NewBQLoadJobStore(ctx, ds)
if err != nil {
t.Fatal(err)
}
bqljcQ, err := NewBQLoadJobCheckQueue("localhost:8080", TasksClient)
if err != nil {
t.Fatal(err)
}
const ds2bqJobID = "helloJob"
{
form := &BQLoadJobPutForm{
JobID: ds2bqJobID,
Kind: "PugEvent",
BQLoadProjectID: "gcpugjp-dev",
BQLoadDatasetID: "datastore",
}
_, err = s.Put(ctx, form)
if err != nil {
t.Fatal(err)
}
}
ls := NewBQLoadService(s, bqljcQ)
if err := ls.InsertBigQueryLoadJob(ctx, ds2bqJobID, "gs://datastore-backup-gcpugjp-dev/2019-07-25T10:35:08_16520"); err != nil {
t.Fatal(err)
}
}