Unverified Commit a183fae6 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #59189 from jianglingxia/jlx-0201

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add UT test TestCheckOpenStackOptsfunc **What this PR does / why we need it**: checkOpenStackOpts func has three case that the test case not Covered,so add it,thanks **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents b1e0f2c0 029317fd
...@@ -234,6 +234,8 @@ func TestCheckOpenStackOpts(t *testing.T) { ...@@ -234,6 +234,8 @@ func TestCheckOpenStackOpts(t *testing.T) {
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786", FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
LBMethod: "ROUND_ROBIN", LBMethod: "ROUND_ROBIN",
CreateMonitor: true, CreateMonitor: true,
MonitorTimeout: timeout,
MonitorMaxRetries: uint(3),
ManageSecurityGroups: true, ManageSecurityGroups: true,
}, },
metadataOpts: MetadataOpts{ metadataOpts: MetadataOpts{
...@@ -273,6 +275,46 @@ func TestCheckOpenStackOpts(t *testing.T) { ...@@ -273,6 +275,46 @@ func TestCheckOpenStackOpts(t *testing.T) {
expectedError: fmt.Errorf("invalid element %q found in section [Metadata] with key `search-order`."+ expectedError: fmt.Errorf("invalid element %q found in section [Metadata] with key `search-order`."+
"Supported elements include %q and %q", "value1", configDriveID, metadataID), "Supported elements include %q and %q", "value1", configDriveID, metadataID),
}, },
{
name: "test7",
openstackOpts: &OpenStack{
provider: nil,
lbOpts: LoadBalancerOpts{
LBVersion: "v2",
SubnetId: "6261548e-ffde-4bc7-bd22-59c83578c5ef",
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
LBMethod: "ROUND_ROBIN",
CreateMonitor: true,
MonitorDelay: delay,
MonitorTimeout: timeout,
ManageSecurityGroups: true,
},
metadataOpts: MetadataOpts{
SearchOrder: configDriveID,
},
},
expectedError: fmt.Errorf("monitor-max-retries not set in cloud provider config"),
},
{
name: "test8",
openstackOpts: &OpenStack{
provider: nil,
lbOpts: LoadBalancerOpts{
LBVersion: "v2",
SubnetId: "6261548e-ffde-4bc7-bd22-59c83578c5ef",
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
LBMethod: "ROUND_ROBIN",
CreateMonitor: true,
MonitorDelay: delay,
MonitorMaxRetries: uint(3),
ManageSecurityGroups: true,
},
metadataOpts: MetadataOpts{
SearchOrder: configDriveID,
},
},
expectedError: fmt.Errorf("monitor-timeout not set in cloud provider config"),
},
} }
for _, testcase := range tests { for _, testcase := range tests {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment