/
terraform_manager.go
158 lines (140 loc) · 3.32 KB
/
terraform_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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package fakes
import (
"github.com/cloudfoundry/bosh-bootloader/storage"
"github.com/cloudfoundry/bosh-bootloader/terraform"
)
type TerraformManager struct {
InitCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
Error error
}
}
SetupCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
Error error
}
}
ApplyCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
BBLState storage.State
Error error
}
}
DestroyCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
BBLState storage.State
Error error
}
}
ValidateCall struct {
CallCount int
Receives struct {
BBLState storage.State
}
Returns struct {
BBLState storage.State
Error error
}
}
ImportCall struct {
CallCount int
Receives struct {
BBLState storage.State
Outputs map[string]string
}
Returns struct {
BBLState storage.State
Error error
}
}
GetOutputsCall struct {
CallCount int
Returns struct {
Outputs terraform.Outputs
Error error
}
}
VersionCall struct {
CallCount int
Returns struct {
Version string
Error error
}
}
ValidateVersionCall struct {
CallCount int
Returns struct {
Error error
}
}
IsPavedCall struct {
CallCount int
Returns struct {
IsPaved bool
Error error
}
}
}
func (t *TerraformManager) Setup(bblState storage.State) error {
t.SetupCall.CallCount++
t.SetupCall.Receives.BBLState = bblState
return t.SetupCall.Returns.Error
}
func (t *TerraformManager) Init(bblState storage.State) error {
t.InitCall.CallCount++
t.InitCall.Receives.BBLState = bblState
return t.InitCall.Returns.Error
}
func (t *TerraformManager) Apply(bblState storage.State) (storage.State, error) {
t.ApplyCall.CallCount++
t.ApplyCall.Receives.BBLState = bblState
return t.ApplyCall.Returns.BBLState, t.ApplyCall.Returns.Error
}
func (t *TerraformManager) Destroy(bblState storage.State) (storage.State, error) {
t.DestroyCall.CallCount++
t.DestroyCall.Receives.BBLState = bblState
return t.DestroyCall.Returns.BBLState, t.DestroyCall.Returns.Error
}
func (t *TerraformManager) Validate(bblState storage.State) (storage.State, error) {
t.ValidateCall.CallCount++
t.ValidateCall.Receives.BBLState = bblState
return t.ValidateCall.Returns.BBLState, t.ValidateCall.Returns.Error
}
func (t *TerraformManager) Import(bblState storage.State, outputs map[string]string) (storage.State, error) {
t.ImportCall.CallCount++
t.ImportCall.Receives.BBLState = bblState
t.ImportCall.Receives.Outputs = outputs
return t.ImportCall.Returns.BBLState, t.ImportCall.Returns.Error
}
func (t *TerraformManager) GetOutputs() (terraform.Outputs, error) {
t.GetOutputsCall.CallCount++
return t.GetOutputsCall.Returns.Outputs, t.GetOutputsCall.Returns.Error
}
func (t *TerraformManager) Version() (string, error) {
t.VersionCall.CallCount++
return t.VersionCall.Returns.Version, t.VersionCall.Returns.Error
}
func (t *TerraformManager) ValidateVersion() error {
t.ValidateVersionCall.CallCount++
return t.ValidateVersionCall.Returns.Error
}
func (t *TerraformManager) IsPaved() (bool, error) {
t.IsPavedCall.CallCount++
return t.IsPavedCall.Returns.IsPaved, t.IsPavedCall.Returns.Error
}