mechanical repercussions
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apimachinery/registered"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
|
||||
@@ -32,17 +31,17 @@ func TestValidatesHostParameter(t *testing.T) {
|
||||
URL string
|
||||
Err bool
|
||||
}{
|
||||
{"127.0.0.1", "", "http://127.0.0.1/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"127.0.0.1:8080", "", "http://127.0.0.1:8080/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"foo.bar.com", "", "http://foo.bar.com/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host/prefix", "", "http://host/prefix/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host", "", "http://host/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host", "/", "http://host/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host", "/other", "http://host/other/" + registered.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"127.0.0.1", "", "http://127.0.0.1/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"127.0.0.1:8080", "", "http://127.0.0.1:8080/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"foo.bar.com", "", "http://foo.bar.com/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host/prefix", "", "http://host/prefix/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host", "", "http://host/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host", "/", "http://host/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"http://host", "/other", "http://host/other/" + api.Registry.GroupOrDie(api.GroupName).GroupVersion.Version, false},
|
||||
{"host/server", "", "", true},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
u, versionedAPIPath, err := DefaultServerURL(testCase.Host, testCase.APIPath, registered.GroupOrDie(api.GroupName).GroupVersion, false)
|
||||
u, versionedAPIPath, err := DefaultServerURL(testCase.Host, testCase.APIPath, api.Registry.GroupOrDie(api.GroupName).GroupVersion, false)
|
||||
switch {
|
||||
case err == nil && testCase.Err:
|
||||
t.Errorf("expected error but was nil")
|
||||
|
||||
Reference in New Issue
Block a user