Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit eb72e6a

Browse files
committed
Add UT test TestCheckOpenStackOptsfunc
1 parent a5b50ab commit eb72e6a

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

pkg/cloudprovider/providers/openstack/openstack_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ func TestCheckOpenStackOpts(t *testing.T) {
234234
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
235235
LBMethod: "ROUND_ROBIN",
236236
CreateMonitor: true,
237+
MonitorTimeout: timeout,
238+
MonitorMaxRetries: uint(3),
237239
ManageSecurityGroups: true,
238240
},
239241
metadataOpts: MetadataOpts{
@@ -273,6 +275,46 @@ func TestCheckOpenStackOpts(t *testing.T) {
273275
expectedError: fmt.Errorf("invalid element %q found in section [Metadata] with key `search-order`."+
274276
"Supported elements include %q and %q", "value1", configDriveID, metadataID),
275277
},
278+
{
279+
name: "test7",
280+
openstackOpts: &OpenStack{
281+
provider: nil,
282+
lbOpts: LoadBalancerOpts{
283+
LBVersion: "v2",
284+
SubnetId: "6261548e-ffde-4bc7-bd22-59c83578c5ef",
285+
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
286+
LBMethod: "ROUND_ROBIN",
287+
CreateMonitor: true,
288+
MonitorDelay: delay,
289+
MonitorTimeout: timeout,
290+
ManageSecurityGroups: true,
291+
},
292+
metadataOpts: MetadataOpts{
293+
SearchOrder: configDriveID,
294+
},
295+
},
296+
expectedError: fmt.Errorf("monitor-max-retries not set in cloud provider config"),
297+
},
298+
{
299+
name: "test8",
300+
openstackOpts: &OpenStack{
301+
provider: nil,
302+
lbOpts: LoadBalancerOpts{
303+
LBVersion: "v2",
304+
SubnetId: "6261548e-ffde-4bc7-bd22-59c83578c5ef",
305+
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
306+
LBMethod: "ROUND_ROBIN",
307+
CreateMonitor: true,
308+
MonitorDelay: delay,
309+
MonitorMaxRetries: uint(3),
310+
ManageSecurityGroups: true,
311+
},
312+
metadataOpts: MetadataOpts{
313+
SearchOrder: configDriveID,
314+
},
315+
},
316+
expectedError: fmt.Errorf("monitor-timeout not set in cloud provider config"),
317+
},
276318
}
277319

278320
for _, testcase := range tests {

0 commit comments

Comments
 (0)