mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Removing more references to v1beta1 from pkg/
This commit is contained in:
@@ -114,8 +114,12 @@ func ResourcePath(resource, namespace, name string) string {
|
||||
// For ex, this is of the form:
|
||||
// /api/v1beta1/pods/pod0?namespace=foo for v1beta1 and
|
||||
// /api/v1beta3/namespaces/foo/pods/pod0 for v1beta3.
|
||||
func ResourcePathWithQueryParams(resource, namespace, name string) string {
|
||||
path := ResourcePath(resource, namespace, name)
|
||||
func ResourcePathWithNamespaceQuery(resource, namespace, name string) string {
|
||||
return ResourcePathWithPrefixAndNamespaceQuery("", resource, namespace, name)
|
||||
}
|
||||
|
||||
func ResourcePathWithPrefixAndNamespaceQuery(prefix, resource, namespace, name string) string {
|
||||
path := ResourcePathWithPrefix(prefix, resource, namespace, name)
|
||||
// Add namespace as query param for pre v1beta3.
|
||||
if api.PreV1Beta3(Version()) && namespace != "" {
|
||||
path = path + "?namespace=" + namespace
|
||||
|
@@ -120,7 +120,7 @@ func TestResourcePathForV1Beta1(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourcePathWithQueryParamsForV1Beta3(t *testing.T) {
|
||||
func TestResourcePathWithNamespaceQueryForV1Beta3(t *testing.T) {
|
||||
if Version() != "v1beta3" {
|
||||
// Skip the test if we are not testing v1beta3.
|
||||
return
|
||||
@@ -138,13 +138,13 @@ func TestResourcePathWithQueryParamsForV1Beta3(t *testing.T) {
|
||||
{"resource", "", "", "/api/v1beta3/resource"},
|
||||
}
|
||||
for _, item := range testCases {
|
||||
if actual := ResourcePathWithQueryParams(item.resource, item.namespace, item.name); actual != item.expected {
|
||||
if actual := ResourcePathWithNamespaceQuery(item.resource, item.namespace, item.name); actual != item.expected {
|
||||
t.Errorf("Expected: %s, got: %s for resource: %s, namespace: %s and name: %s", item.expected, actual, item.resource, item.namespace, item.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourcePathWithQueryParamsForV1Beta1(t *testing.T) {
|
||||
func TestResourcePathWithNamespaceQueryForV1Beta1(t *testing.T) {
|
||||
if Version() != "v1beta1" {
|
||||
// Skip the test if we are not testing v1beta1.
|
||||
return
|
||||
@@ -162,7 +162,7 @@ func TestResourcePathWithQueryParamsForV1Beta1(t *testing.T) {
|
||||
{"resource", "", "", "/api/v1beta1/resource"},
|
||||
}
|
||||
for _, item := range testCases {
|
||||
if actual := ResourcePathWithQueryParams(item.resource, item.namespace, item.name); actual != item.expected {
|
||||
if actual := ResourcePathWithNamespaceQuery(item.resource, item.namespace, item.name); actual != item.expected {
|
||||
t.Errorf("Expected: %s, got: %s for resource: %s, namespace: %s and name: %s", item.expected, actual, item.resource, item.namespace, item.name)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user