forked from hashicorp/packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote_driver_mock.go
69 lines (53 loc) · 1.34 KB
/
remote_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
package iso
import (
vmwcommon "github.com/hashicorp/packer/builder/vmware/common"
)
type RemoteDriverMock struct {
vmwcommon.DriverMock
UploadISOCalled bool
UploadISOPath string
UploadISOResult string
UploadISOErr error
RegisterCalled bool
RegisterPath string
RegisterErr error
UnregisterCalled bool
UnregisterPath string
UnregisterErr error
DestroyCalled bool
DestroyErr error
IsDestroyedCalled bool
IsDestroyedResult bool
IsDestroyedErr error
uploadErr error
ReloadVMErr error
}
func (d *RemoteDriverMock) UploadISO(path string, checksum string, checksumType string) (string, error) {
d.UploadISOCalled = true
d.UploadISOPath = path
return d.UploadISOResult, d.UploadISOErr
}
func (d *RemoteDriverMock) Register(path string) error {
d.RegisterCalled = true
d.RegisterPath = path
return d.RegisterErr
}
func (d *RemoteDriverMock) Unregister(path string) error {
d.UnregisterCalled = true
d.UnregisterPath = path
return d.UnregisterErr
}
func (d *RemoteDriverMock) Destroy() error {
d.DestroyCalled = true
return d.DestroyErr
}
func (d *RemoteDriverMock) IsDestroyed() (bool, error) {
d.DestroyCalled = true
return d.IsDestroyedResult, d.IsDestroyedErr
}
func (d *RemoteDriverMock) upload(dst, src string) error {
return d.uploadErr
}
func (d *RemoteDriverMock) ReloadVM() error {
return d.ReloadVMErr
}