mirror of https://github.com/k3s-io/k3s
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 ```pull/6/head
commit
a183fae672
|
@ -234,6 +234,8 @@ func TestCheckOpenStackOpts(t *testing.T) {
|
|||
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
|
||||
LBMethod: "ROUND_ROBIN",
|
||||
CreateMonitor: true,
|
||||
MonitorTimeout: timeout,
|
||||
MonitorMaxRetries: uint(3),
|
||||
ManageSecurityGroups: true,
|
||||
},
|
||||
metadataOpts: MetadataOpts{
|
||||
|
@ -273,6 +275,46 @@ func TestCheckOpenStackOpts(t *testing.T) {
|
|||
expectedError: fmt.Errorf("invalid element %q found in section [Metadata] with key `search-order`."+
|
||||
"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 {
|
||||
|
|
Loading…
Reference in New Issue