-
Notifications
You must be signed in to change notification settings - Fork 0
/
export_test.go
57 lines (46 loc) · 1.54 KB
/
export_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
// Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package mongo
import (
"github.com/golang/mock/gomock"
"github.com/juju/juju/service/common"
svctesting "github.com/juju/juju/service/common/testing"
)
var (
MakeJournalDirs = makeJournalDirs
MongoConfigPath = &mongoConfigPath
SharedSecretPath = sharedSecretPath
SSLKeyPath = sslKeyPath
NewConf = newConf
GenerateConf = generateConfig
HostWordSize = &hostWordSize
RuntimeGOOS = &runtimeGOOS
AvailSpace = &availSpace
SmallOplogSizeMB = &smallOplogSizeMB
PreallocFile = &preallocFile
DefaultOplogSize = defaultOplogSize
FsAvailSpace = fsAvailSpace
PreallocFileSizes = preallocFileSizes
PreallocFiles = preallocFiles
)
func PatchService(patchValue func(interface{}, interface{}), data *svctesting.FakeServiceData) {
patchValue(&discoverService, func(name string) (mongoService, error) {
svc := svctesting.NewFakeService(name, common.Conf{})
svc.FakeServiceData = data
return svc, nil
})
patchValue(&newService, func(name string, _ bool, conf common.Conf) (mongoService, error) {
svc := svctesting.NewFakeService(name, conf)
svc.FakeServiceData = data
return svc, nil
})
}
func SysctlEditableEnsureServer(args EnsureServerParams, sysctlFiles map[string]string) (Version, error) {
return ensureServer(args, sysctlFiles)
}
func NewMongodFinderWithMockSearch(ctrl *gomock.Controller) (*MongodFinder, *MockSearchTools) {
tools := NewMockSearchTools(ctrl)
return &MongodFinder{
search: tools,
}, tools
}