Skip to content

Commit 346738a

Browse files
update unit tests
1 parent 5060406 commit 346738a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

builder/gridscale/step_create_boot_storage_test.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ func Test_stepCreateBootStorage_Cleanup(t *testing.T) {
110110

111111
func Test_stepCreateBootStorage_Run(t *testing.T) {
112112
type fields struct {
113-
client gsclient.StorageOperator
114-
config *Config
115-
ui packer.Ui
113+
client gsclient.StorageOperator
114+
templateClient gsclient.TemplateOperator
115+
config *Config
116+
ui packer.Ui
116117
}
117118
type args struct {
118119
ctx context.Context
@@ -128,7 +129,8 @@ func Test_stepCreateBootStorage_Run(t *testing.T) {
128129
{
129130
name: "success",
130131
fields: fields{
131-
client: StorageOperatorMock{},
132+
client: StorageOperatorMock{},
133+
templateClient: TemplateOperatorMock{},
132134
config: produceTestConfig(map[string]interface{}{
133135
"server_name": "success",
134136
}),
@@ -145,7 +147,8 @@ func Test_stepCreateBootStorage_Run(t *testing.T) {
145147
{
146148
name: "API call fail",
147149
fields: fields{
148-
client: StorageOperatorMock{},
150+
client: StorageOperatorMock{},
151+
templateClient: TemplateOperatorMock{},
149152
config: produceTestConfig(map[string]interface{}{
150153
"server_name": "fail",
151154
}),
@@ -162,7 +165,8 @@ func Test_stepCreateBootStorage_Run(t *testing.T) {
162165
{
163166
name: "No SSH key UUID detected",
164167
fields: fields{
165-
client: StorageOperatorMock{},
168+
client: StorageOperatorMock{},
169+
templateClient: TemplateOperatorMock{},
166170
config: produceTestConfig(map[string]interface{}{
167171
"server_name": "success",
168172
}),
@@ -179,7 +183,8 @@ func Test_stepCreateBootStorage_Run(t *testing.T) {
179183
{
180184
name: "cannot convert ssh_key_uuid to string",
181185
fields: fields{
182-
client: StorageOperatorMock{},
186+
client: StorageOperatorMock{},
187+
templateClient: TemplateOperatorMock{},
183188
config: produceTestConfig(map[string]interface{}{
184189
"server_name": "success",
185190
}),
@@ -195,9 +200,10 @@ func Test_stepCreateBootStorage_Run(t *testing.T) {
195200
for _, tt := range tests {
196201
t.Run(tt.name, func(t *testing.T) {
197202
s := &stepCreateBootStorage{
198-
client: tt.fields.client,
199-
config: tt.fields.config,
200-
ui: tt.fields.ui,
203+
client: tt.fields.client,
204+
templateClient: tt.fields.templateClient,
205+
config: tt.fields.config,
206+
ui: tt.fields.ui,
201207
}
202208
if got := s.Run(tt.args.ctx, tt.args.state); got != tt.want {
203209
t.Errorf("stepCreateBootStorage_Run() = %v, want %v", got, tt.want)

0 commit comments

Comments
 (0)