forked from cloudfoundry-attic/bosh-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_manager.go
52 lines (42 loc) · 1.15 KB
/
fake_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
package fakes
import (
bideplmanifest "github.com/cloudfoundry/bosh-init/deployment/manifest"
bivm "github.com/cloudfoundry/bosh-init/deployment/vm"
bistemcell "github.com/cloudfoundry/bosh-init/stemcell"
)
type CreateInput struct {
Stemcell bistemcell.CloudStemcell
Manifest bideplmanifest.Manifest
}
type FakeManager struct {
CreateInput CreateInput
CreateVM bivm.VM
CreateErr error
findCurrentBehaviour findCurrentOutput
}
type findCurrentOutput struct {
vm bivm.VM
found bool
err error
}
func NewFakeManager() *FakeManager {
return &FakeManager{}
}
func (m *FakeManager) FindCurrent() (bivm.VM, bool, error) {
return m.findCurrentBehaviour.vm, m.findCurrentBehaviour.found, m.findCurrentBehaviour.err
}
func (m *FakeManager) Create(stemcell bistemcell.CloudStemcell, deploymentManifest bideplmanifest.Manifest) (bivm.VM, error) {
input := CreateInput{
Stemcell: stemcell,
Manifest: deploymentManifest,
}
m.CreateInput = input
return m.CreateVM, m.CreateErr
}
func (m *FakeManager) SetFindCurrentBehavior(vm bivm.VM, found bool, err error) {
m.findCurrentBehaviour = findCurrentOutput{
vm: vm,
found: found,
err: err,
}
}