forked from hashicorp/packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
driver_mock.go
140 lines (112 loc) · 2.76 KB
/
driver_mock.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package common
import (
"sync"
"github.com/mitchellh/multistep"
)
type DriverMock struct {
sync.Mutex
CloneCalled bool
CloneDst string
CloneSrc string
CloneErr error
CompactDiskCalled bool
CompactDiskPath string
CompactDiskErr error
CreateDiskCalled bool
CreateDiskOutput string
CreateDiskSize string
CreateDiskTypeId string
CreateDiskErr error
IsRunningCalled bool
IsRunningPath string
IsRunningResult bool
IsRunningErr error
CommHostCalled bool
CommHostState multistep.StateBag
CommHostResult string
CommHostErr error
StartCalled bool
StartPath string
StartHeadless bool
StartErr error
StopCalled bool
StopPath string
StopErr error
SuppressMessagesCalled bool
SuppressMessagesPath string
SuppressMessagesErr error
ToolsIsoPathCalled bool
ToolsIsoPathFlavor string
ToolsIsoPathResult string
ToolsInstallCalled bool
ToolsInstallErr error
DhcpLeasesPathCalled bool
DhcpLeasesPathDevice string
DhcpLeasesPathResult string
VerifyCalled bool
VerifyErr error
}
func (d *DriverMock) Clone(dst string, src string) error {
d.CloneCalled = true
d.CloneDst = dst
d.CloneSrc = src
return d.CloneErr
}
func (d *DriverMock) CompactDisk(path string) error {
d.CompactDiskCalled = true
d.CompactDiskPath = path
return d.CompactDiskErr
}
func (d *DriverMock) CreateDisk(output string, size string, typeId string) error {
d.CreateDiskCalled = true
d.CreateDiskOutput = output
d.CreateDiskSize = size
d.CreateDiskTypeId = typeId
return d.CreateDiskErr
}
func (d *DriverMock) IsRunning(path string) (bool, error) {
d.Lock()
defer d.Unlock()
d.IsRunningCalled = true
d.IsRunningPath = path
return d.IsRunningResult, d.IsRunningErr
}
func (d *DriverMock) CommHost(state multistep.StateBag) (string, error) {
d.CommHostCalled = true
d.CommHostState = state
return d.CommHostResult, d.CommHostErr
}
func (d *DriverMock) Start(path string, headless bool) error {
d.StartCalled = true
d.StartPath = path
d.StartHeadless = headless
return d.StartErr
}
func (d *DriverMock) Stop(path string) error {
d.StopCalled = true
d.StopPath = path
return d.StopErr
}
func (d *DriverMock) SuppressMessages(path string) error {
d.SuppressMessagesCalled = true
d.SuppressMessagesPath = path
return d.SuppressMessagesErr
}
func (d *DriverMock) ToolsIsoPath(flavor string) string {
d.ToolsIsoPathCalled = true
d.ToolsIsoPathFlavor = flavor
return d.ToolsIsoPathResult
}
func (d *DriverMock) ToolsInstall() error {
d.ToolsInstallCalled = true
return d.ToolsInstallErr
}
func (d *DriverMock) DhcpLeasesPath(device string) string {
d.DhcpLeasesPathCalled = true
d.DhcpLeasesPathDevice = device
return d.DhcpLeasesPathResult
}
func (d *DriverMock) Verify() error {
d.VerifyCalled = true
return d.VerifyErr
}