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
|
package mongodump
import (
"testing"
"github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
func TestSkipCollection(t *testing.T) {
testtype.VerifyTestType(t, testtype.UnitTestType)
Convey("With a mongodump that excludes collections 'test' and 'fake'"+
" and excludes prefixes 'pre-' and 'no'", t, func() {
md := &MongoDump{
OutputOptions: &OutputOptions{
ExcludedCollections: []string{"test", "fake"},
ExcludedCollectionPrefixes: []string{"pre-", "no"},
},
}
Convey("collection 'pre-test' should be skipped", func() {
So(md.shouldSkipCollection("pre-test"), ShouldBeTrue)
})
Convey("collection 'notest' should be skipped", func() {
So(md.shouldSkipCollection("notest"), ShouldBeTrue)
})
Convey("collection 'test' should be skipped", func() {
So(md.shouldSkipCollection("test"), ShouldBeTrue)
})
Convey("collection 'fake' should be skipped", func() {
So(md.shouldSkipCollection("fake"), ShouldBeTrue)
})
Convey("collection 'fake222' should not be skipped", func() {
So(md.shouldSkipCollection("fake222"), ShouldBeFalse)
})
Convey("collection 'random' should not be skipped", func() {
So(md.shouldSkipCollection("random"), ShouldBeFalse)
})
Convey("collection 'mytest' should not be skipped", func() {
So(md.shouldSkipCollection("mytest"), ShouldBeFalse)
})
})
}
|