mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 04:32:37 +00:00
Do not use namespace in url paths pre v1beta3 from client
This commit is contained in:
@@ -37,6 +37,13 @@ import (
|
||||
"github.com/coreos/go-etcd/etcd"
|
||||
)
|
||||
|
||||
func makeNamespaceURL(namespace, suffix string) string {
|
||||
if client.NamespaceInPathFor(testapi.Version()) {
|
||||
return makeURL("/ns/" + namespace + suffix)
|
||||
}
|
||||
return makeURL(suffix + "?namespace=" + namespace)
|
||||
}
|
||||
|
||||
func makeURL(suffix string) string {
|
||||
return path.Join("/api", testapi.Version(), suffix)
|
||||
}
|
||||
@@ -221,7 +228,7 @@ func TestCreateReplica(t *testing.T) {
|
||||
},
|
||||
Spec: controllerSpec.Spec.Template.Spec,
|
||||
}
|
||||
fakeHandler.ValidateRequest(t, makeURL("/ns/default/pods"), "POST", nil)
|
||||
fakeHandler.ValidateRequest(t, makeNamespaceURL("default", "/pods"), "POST", nil)
|
||||
actualPod, err := client.Codec.Decode([]byte(fakeHandler.RequestBody))
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %#v", err)
|
||||
|
Reference in New Issue
Block a user