-
Notifications
You must be signed in to change notification settings - Fork 8
/
data_copier_test.go
40 lines (32 loc) · 940 Bytes
/
data_copier_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
// Copyright Kuei-chun Chen, 2022-present. All rights reserved.
package hummingbird
import (
"context"
"testing"
"github.com/simagix/keyhole/mdb"
)
func TestDataCopier(t *testing.T) {
ctx := context.Background()
dbName, _ := mdb.SplitNamespace(TestNS)
source, err := GetMongoClient(TestSourceURI)
assertEqual(t, nil, err)
err = source.Database(dbName).Drop(ctx)
assertEqual(t, nil, err)
target, err := GetMongoClient(TestTargetURI)
assertEqual(t, nil, err)
err = target.Database(dbName).Drop(ctx)
assertEqual(t, nil, err)
filename := "testdata/data-only.json"
inst, err := NewMigratorInstance(filename)
assertEqual(t, nil, err)
ws := inst.Workspace()
err = ws.Reset()
assertEqual(t, nil, err)
err = DataCopier()
assertEqual(t, nil, err)
}
func TestGetQualifiedCollections(t *testing.T) {
includes, err := getQualifiedCollections(TestReplicaURI)
assertEqual(t, nil, err)
assertNotEqual(t, 0, len(includes))
}