forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_disk_manager.go
63 lines (53 loc) · 1.83 KB
/
fake_disk_manager.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
63
package fakes
import (
boshdevutil "github.com/cloudfoundry/bosh-agent/platform/deviceutil"
fakedevutil "github.com/cloudfoundry/bosh-agent/platform/deviceutil/fakes"
boshdisk "github.com/cloudfoundry/bosh-agent/platform/disk"
)
type FakeDiskManager struct {
FakePartitioner *FakePartitioner
FakeFormatter *FakeFormatter
FakeMounter *FakeMounter
FakeMountsSearcher *FakeMountsSearcher
FakeRootDevicePartitioner *FakePartitioner
FakeDiskUtil *fakedevutil.FakeDeviceUtil
DiskUtilDiskPath string
PartedPartitionerCalled bool
PartitionerCalled bool
}
func NewFakeDiskManager() *FakeDiskManager {
return &FakeDiskManager{
FakePartitioner: NewFakePartitioner(),
FakeFormatter: &FakeFormatter{},
FakeMounter: &FakeMounter{},
FakeMountsSearcher: &FakeMountsSearcher{},
FakeRootDevicePartitioner: NewFakePartitioner(),
FakeDiskUtil: fakedevutil.NewFakeDeviceUtil(),
PartedPartitionerCalled: false,
PartitionerCalled: false,
}
}
func (m *FakeDiskManager) GetPartitioner() boshdisk.Partitioner {
m.PartitionerCalled = true
return m.FakePartitioner
}
func (m *FakeDiskManager) GetPartedPartitioner() boshdisk.Partitioner {
m.PartedPartitionerCalled = true
return m.FakePartitioner
}
func (m *FakeDiskManager) GetRootDevicePartitioner() boshdisk.Partitioner {
return m.FakeRootDevicePartitioner
}
func (m *FakeDiskManager) GetFormatter() boshdisk.Formatter {
return m.FakeFormatter
}
func (m *FakeDiskManager) GetMounter() boshdisk.Mounter {
return m.FakeMounter
}
func (m *FakeDiskManager) GetMountsSearcher() boshdisk.MountsSearcher {
return m.FakeMountsSearcher
}
func (m *FakeDiskManager) GetDiskUtil(diskPath string) boshdevutil.DeviceUtil {
m.DiskUtilDiskPath = diskPath
return m.FakeDiskUtil
}