/
fake.go
300 lines (250 loc) · 6.77 KB
/
fake.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
package fake
import (
"github.com/gazebo-web/cloudsim/v4/pkg/simulations"
"github.com/gazebo-web/cloudsim/v4/pkg/store"
"github.com/stretchr/testify/mock"
"time"
)
// Fake is a fake store.Store implementation.
type Fake struct {
machines store.Machines
orchestrator store.Orchestrator
ignition store.Ignition
}
// Machines mocks the Machine store.
func (f *Fake) Machines() store.Machines {
return f.machines
}
// Orchestrator mocks the Orchestrator store.
func (f *Fake) Orchestrator() store.Orchestrator {
return f.orchestrator
}
// Ignition mocks the Ignition store.
func (f *Fake) Ignition() store.Ignition {
return f.ignition
}
// NewFakeStore initializes a new fake store implementation using fake configuration providers.
// This provider uses the mock library
func NewFakeStore(machines *Machines, orchestrator *Orchestrator, ignition *Ign) *Fake {
return &Fake{
machines: machines,
orchestrator: orchestrator,
ignition: ignition,
}
}
// NewDefaultFakeStore initializes a new fake store implementation using default fake configuration providers.
// This provider uses the mock library
func NewDefaultFakeStore() *Fake {
return &Fake{
machines: NewFakeMachines(),
orchestrator: NewFakeOrchestrator(),
ignition: NewFakeIgnition(),
}
}
// Ign is a fake store.Ignition implementation.
type Ign struct {
*mock.Mock
}
var _ store.Ignition = (*Ign)(nil)
// DefaultRecipients mocks the DefaultRecipients method.
func (f *Ign) DefaultRecipients() []string {
args := f.Called()
return args.Get(0).([]string)
}
// DefaultSender mocks the DefaultSender method.
func (f *Ign) DefaultSender() string {
args := f.Called()
return args.String(0)
}
// LogsBucket mocks the LogsBucket method.
func (f *Ign) LogsBucket() string {
args := f.Called()
return args.String(0)
}
// GetWebsocketPath mocks the GetWebsocketPath method.
func (f *Ign) GetWebsocketPath(groupID simulations.GroupID) string {
args := f.Called(groupID)
return args.String(0)
}
// AccessKeyLabel mocks the AccessKeyLabel method.
func (f *Ign) AccessKeyLabel() string {
args := f.Called()
return args.String(0)
}
// SecretAccessKeyLabel mocks the SecretAccessKeyLabel method.
func (f *Ign) SecretAccessKeyLabel() string {
args := f.Called()
return args.String(0)
}
// LogsCopyEnabled mocks the LogsCopyEnabled method.
func (f *Ign) LogsCopyEnabled() bool {
args := f.Called()
return args.Bool(0)
}
// Region mocks the Region method.
func (f *Ign) Region() string {
args := f.Called()
return args.String(0)
}
// SecretsName mocks the SecretsName method.
func (f *Ign) SecretsName() string {
args := f.Called()
return args.String(0)
}
// IP mocks the IP method.
func (f *Ign) IP() string {
args := f.Called()
return args.String(0)
}
// GazeboServerLogsPath mocks the GazeboServerLogsPath method.
func (f *Ign) GazeboServerLogsPath() string {
args := f.Called()
return args.String(0)
}
// ROSLogsPath mocks the ROSLogsPath method.
func (f *Ign) ROSLogsPath() string {
args := f.Called()
return args.String(0)
}
// SidecarContainerLogsPath mocks the SidecarContainerLogsPath method.
func (f *Ign) SidecarContainerLogsPath() string {
args := f.Called()
return args.String(0)
}
// Verbosity mocks the Verbosity method.
func (f *Ign) Verbosity() string {
args := f.Called()
return args.String(0)
}
// NewFakeIgnition initializes a fake store.Ignition implementation.
func NewFakeIgnition() *Ign {
return &Ign{
Mock: new(mock.Mock),
}
}
// Orchestrator is a fake store.Orchestrator implementation.
type Orchestrator struct {
*mock.Mock
}
var _ store.Orchestrator = (*Orchestrator)(nil)
// Timeout mocks the Timeout method.
func (f Orchestrator) Timeout() time.Duration {
args := f.Called()
return args.Get(0).(time.Duration)
}
// PollFrequency mocks the PollFrequency method.
func (f Orchestrator) PollFrequency() time.Duration {
args := f.Called()
return args.Get(0).(time.Duration)
}
// IngressNamespace mocks the IngressNamespace method.
func (f Orchestrator) IngressNamespace() string {
args := f.Called()
return args.String(0)
}
// IngressName mocks the IngressName method.
func (f Orchestrator) IngressName() string {
args := f.Called()
return args.String(0)
}
// IngressHost mocks the IngressHost method.
func (f Orchestrator) IngressHost() string {
args := f.Called()
return args.String(0)
}
// Namespace mocks the Namespace method.
func (f Orchestrator) Namespace() string {
args := f.Called()
return args.String(0)
}
// TerminationGracePeriod mocks the TerminationGracePeriod method.
func (f Orchestrator) TerminationGracePeriod() time.Duration {
args := f.Called()
return args.Get(0).(time.Duration)
}
// Nameservers mocks the Nameservers method.
func (f Orchestrator) Nameservers() []string {
args := f.Called()
return args.Get(0).([]string)
}
// NewFakeOrchestrator initializes a new store.Orchestrator implementation.
func NewFakeOrchestrator() *Orchestrator {
return &Orchestrator{
Mock: new(mock.Mock),
}
}
// Machines is a fake store.Machines implementation.
type Machines struct {
*mock.Mock
}
var _ store.Machines = (*Machines)(nil)
// InstanceProfile mocks the InstanceProfile method.
func (f Machines) InstanceProfile() *string {
args := f.Called()
result := args.String(0)
if len(result) == 0 {
return nil
}
return &result
}
// KeyName mocks the KeyName method.
func (f Machines) KeyName() string {
args := f.Called()
return args.String(0)
}
// Type mocks the Type method.
func (f Machines) Type() string {
args := f.Called()
return args.String(0)
}
// SidecarType mocks the SidecarType method.
func (f Machines) SidecarType() string {
args := f.Called()
return args.String(0)
}
// FirewallRules mocks the FirewallRules method.
func (f Machines) FirewallRules() []string {
args := f.Called()
return args.Get(0).([]string)
}
// BaseImage mocks the BaseImage method.
func (f Machines) BaseImage() string {
args := f.Called()
return args.String(0)
}
// BaseImageGPU mocks the BaseImageGPU method.
func (f Machines) BaseImageGPU() string {
args := f.Called()
return args.String(0)
}
// Timeout mocks the Timeout method.
func (f Machines) Timeout() time.Duration {
args := f.Called()
return args.Get(0).(time.Duration)
}
// PollFrequency mocks the PollFrequency method.
func (f Machines) PollFrequency() time.Duration {
args := f.Called()
return args.Get(0).(time.Duration)
}
// Limit mocks the Limit method.
func (f Machines) Limit() int {
args := f.Called()
return args.Int(0)
}
// NamePrefix mocks the NamePrefix method.
func (f Machines) NamePrefix() string {
args := f.Called()
return args.String(0)
}
// ClusterName mocks the ClusterName method.
func (f Machines) ClusterName() string {
args := f.Called()
return args.String(0)
}
// NewFakeMachines initializes a new store.Machines implementation.
func NewFakeMachines() *Machines {
return &Machines{
Mock: new(mock.Mock),
}
}