forked from cloudfoundry-attic/bosh-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_vm_repo.go
43 lines (34 loc) · 879 Bytes
/
fake_vm_repo.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
package fakes
type FakeVMRepo struct {
UpdateCurrentCID string
UpdateCurrentErr error
ClearCurrentCalled bool
ClearCurrentErr error
findCurrentOutput vmRepoFindCurrentOutput
}
type vmRepoFindCurrentOutput struct {
cid string
found bool
err error
}
func NewFakeVMRepo() *FakeVMRepo {
return &FakeVMRepo{}
}
func (r *FakeVMRepo) FindCurrent() (cid string, found bool, err error) {
return r.findCurrentOutput.cid, r.findCurrentOutput.found, r.findCurrentOutput.err
}
func (r *FakeVMRepo) SetFindCurrentBehavior(cid string, found bool, err error) {
r.findCurrentOutput = vmRepoFindCurrentOutput{
cid: cid,
found: found,
err: err,
}
}
func (r *FakeVMRepo) UpdateCurrent(cid string) error {
r.UpdateCurrentCID = cid
return r.UpdateCurrentErr
}
func (r *FakeVMRepo) ClearCurrent() error {
r.ClearCurrentCalled = true
return r.ClearCurrentErr
}