This commit is contained in:
Drew Anderson 2021-07-15 12:15:26 +02:00
Родитель 118da75dc8
Коммит 26cc634bd1
2 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -4,7 +4,6 @@ package v20210131preview
// Licensed under the Apache License 2.0.
import (
"fmt"
"net"
"net/http"
"net/url"
@ -214,9 +213,7 @@ func (sv *openShiftClusterStaticValidator) validateNetworkProfile(path string, n
switch np.SDNProvider {
case SDNProviderOVNKubernetes, SDNProviderOpenShiftSDN:
default:
fmt.Println(np.SDNProvider)
errorMsg := fmt.Sprintf("The provided SDNProvider must be either '%s' or '%s'.", SDNProviderOVNKubernetes, SDNProviderOpenShiftSDN)
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".sdnProvider", errorMsg)
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".sdnProvider", "The provided SDNProvider '%s' is invalid.", np.SDNProvider)
}
return nil

Просмотреть файл

@ -473,7 +473,7 @@ func TestOpenShiftClusterStaticValidateNetworkProfileType(t *testing.T) {
modify: func(oc *OpenShiftCluster) {
oc.Properties.NetworkProfile.SDNProvider = "InvalidOption"
},
wantErr: "400: InvalidParameter: properties.networkProfile.sdnProvider: The provided SDNProvider must be either 'OVNKubernetes' or 'OpenShiftSDN'.",
wantErr: "400: InvalidParameter: properties.networkProfile.sdnProvider: The provided SDNProvider 'InvalidOption' is invalid.",
},
{
name: "networkProvider",
@ -498,7 +498,7 @@ func TestOpenShiftClusterStaticValidateNetworkProfileType(t *testing.T) {
modify: func(oc *OpenShiftCluster) {
oc.Properties.NetworkProfile.SDNProvider = "InvalidOption"
},
wantErr: "400: InvalidParameter: properties.networkProfile.sdnProvider: The provided SDNProvider must be either 'OVNKubernetes' or 'OpenShiftSDN'.",
wantErr: "400: InvalidParameter: properties.networkProfile.sdnProvider: The provided SDNProvider 'InvalidOption' is invalid.",
},
{
name: "networkProvider",