mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Fix apiversion slash
This commit is contained in:
@@ -1,18 +1,5 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
// Copyright 2018 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package resid
|
||||
|
||||
@@ -112,17 +99,31 @@ var stringTests = []struct {
|
||||
|
||||
func TestString(t *testing.T) {
|
||||
for _, hey := range stringTests {
|
||||
if hey.x.String() != hey.s {
|
||||
t.Fatalf("bad string for %v '%s'", hey.x, hey.s)
|
||||
}
|
||||
assert.Equal(t, hey.s, hey.x.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestApiVersion(t *testing.T) {
|
||||
for _, hey := range []struct {
|
||||
x Gvk
|
||||
exp string
|
||||
}{
|
||||
{Gvk{}, ""},
|
||||
{Gvk{Kind: "k"}, ""},
|
||||
{Gvk{Version: "v"}, "v"},
|
||||
{Gvk{Version: "v", Kind: "k"}, "v"},
|
||||
{Gvk{Group: "g"}, "g/"},
|
||||
{Gvk{Group: "g", Kind: "k"}, "g/"},
|
||||
{Gvk{Group: "g", Version: "v"}, "g/v"},
|
||||
{Gvk{Group: "g", Version: "v", Kind: "k"}, "g/v"},
|
||||
} {
|
||||
assert.Equal(t, hey.exp, hey.x.ApiVersion())
|
||||
}
|
||||
}
|
||||
|
||||
func TestStringWoEmptyField(t *testing.T) {
|
||||
for _, hey := range stringTests {
|
||||
if hey.x.StringWoEmptyField() != hey.r {
|
||||
t.Fatalf("bad string %s for %v '%s'", hey.x.StringWoEmptyField(), hey.x, hey.r)
|
||||
}
|
||||
assert.Equal(t, hey.r, hey.x.StringWoEmptyField())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,12 +142,8 @@ func TestParseGroupVersion(t *testing.T) {
|
||||
}
|
||||
for _, tc := range tests {
|
||||
g, v := ParseGroupVersion(tc.input)
|
||||
if g != tc.g {
|
||||
t.Errorf("%s: expected group '%s', got '%s'", tc.input, tc.g, g)
|
||||
}
|
||||
if v != tc.v {
|
||||
t.Errorf("%s: expected version '%s', got '%s'", tc.input, tc.v, v)
|
||||
}
|
||||
assert.Equal(t, tc.g, g, tc.input)
|
||||
assert.Equal(t, tc.v, v, tc.input)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,9 +249,7 @@ func TestSelectByGVK(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
filtered := tc.in.IsSelected(tc.filter)
|
||||
if filtered != tc.expected {
|
||||
t.Fatalf("unexpected filter result for test case: %v", tc.description)
|
||||
}
|
||||
assert.Equal(t, tc.expected, filtered, tc.description)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user