@@ -12,7 +12,7 @@ import (
12
12
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
13
13
"k8s.io/apimachinery/pkg/runtime/schema"
14
14
cmdtesting "k8s.io/kubectl/pkg/cmd/testing"
15
- . "sigs.k8s.io/cli-utils/pkg/object" //nolint:revive
15
+ "sigs.k8s.io/cli-utils/pkg/object"
16
16
"sigs.k8s.io/cli-utils/pkg/testutil"
17
17
)
18
18
@@ -84,11 +84,11 @@ metadata:
84
84
func TestUnstructuredToObjMeta (t * testing.T ) {
85
85
tests := map [string ]struct {
86
86
obj * unstructured.Unstructured
87
- expected ObjMetadata
87
+ expected object. ObjMetadata
88
88
}{
89
89
"test RBAC translation" : {
90
90
obj : testutil .Unstructured (t , rbac ),
91
- expected : ObjMetadata {
91
+ expected : object. ObjMetadata {
92
92
Name : "test-cluster-role" ,
93
93
GroupKind : schema.GroupKind {
94
94
Group : "rbac.authorization.k8s.io" ,
@@ -98,7 +98,7 @@ func TestUnstructuredToObjMeta(t *testing.T) {
98
98
},
99
99
"test CRD translation" : {
100
100
obj : testutil .Unstructured (t , testCRD ),
101
- expected : ObjMetadata {
101
+ expected : object. ObjMetadata {
102
102
Name : "test-crd" ,
103
103
GroupKind : schema.GroupKind {
104
104
Group : "apiextensions.k8s.io" ,
@@ -108,7 +108,7 @@ func TestUnstructuredToObjMeta(t *testing.T) {
108
108
},
109
109
"test pod translation" : {
110
110
obj : testutil .Unstructured (t , testPod ),
111
- expected : ObjMetadata {
111
+ expected : object. ObjMetadata {
112
112
Name : "test-pod" ,
113
113
Namespace : "test-namespace" ,
114
114
GroupKind : schema.GroupKind {
@@ -121,7 +121,7 @@ func TestUnstructuredToObjMeta(t *testing.T) {
121
121
122
122
for name , tc := range tests {
123
123
t .Run (name , func (t * testing.T ) {
124
- actual := UnstructuredToObjMetadata (tc .obj )
124
+ actual := object . UnstructuredToObjMetadata (tc .obj )
125
125
if tc .expected != actual {
126
126
t .Errorf ("expected ObjMetadata (%s), got (%s)" , tc .expected , actual )
127
127
}
@@ -154,7 +154,7 @@ func TestIsKindNamespace(t *testing.T) {
154
154
155
155
for name , tc := range tests {
156
156
t .Run (name , func (t * testing.T ) {
157
- actual := IsKindNamespace (tc .obj )
157
+ actual := object . IsKindNamespace (tc .obj )
158
158
if tc .isKindNamespace != actual {
159
159
t .Errorf ("expected IsKindNamespace (%t), got (%t) for (%s)" ,
160
160
tc .isKindNamespace , actual , tc .obj )
@@ -188,7 +188,7 @@ func TestIsCRD(t *testing.T) {
188
188
189
189
for name , tc := range tests {
190
190
t .Run (name , func (t * testing.T ) {
191
- actual := IsCRD (tc .obj )
191
+ actual := object . IsCRD (tc .obj )
192
192
if tc .isCRD != actual {
193
193
t .Errorf ("expected IsCRD (%t), got (%t) for (%s)" , tc .isCRD , actual , tc .obj )
194
194
}
@@ -225,7 +225,7 @@ func TestIsNamespaced(t *testing.T) {
225
225
226
226
for name , tc := range tests {
227
227
t .Run (name , func (t * testing.T ) {
228
- actual := IsNamespaced (tc .obj )
228
+ actual := object . IsNamespaced (tc .obj )
229
229
if tc .isNamespaced != actual {
230
230
t .Errorf ("expected namespaced (%t), got (%t) for (%s)" ,
231
231
tc .isNamespaced , actual , tc .obj )
@@ -259,7 +259,7 @@ func TestGetCRDGroupKind(t *testing.T) {
259
259
260
260
for name , tc := range tests {
261
261
t .Run (name , func (t * testing.T ) {
262
- actualGroupKind , actualIsCRD := GetCRDGroupKind (tc .obj )
262
+ actualGroupKind , actualIsCRD := object . GetCRDGroupKind (tc .obj )
263
263
if tc .isCRD != actualIsCRD {
264
264
t .Errorf ("expected IsCRD (%t), got (%t) for (%s)" , tc .isCRD , actualIsCRD , tc .obj )
265
265
}
@@ -284,7 +284,7 @@ func TestLookupResourceScope(t *testing.T) {
284
284
},
285
285
"CR not found in the RESTMapper or the provided CRDs" : {
286
286
resource : testutil .Unstructured (t , testCR ),
287
- expectedErr : & UnknownTypeError {
287
+ expectedErr : & object. UnknownTypeError {
288
288
GroupVersionKind : schema.GroupVersionKind {
289
289
Group : "example.com" ,
290
290
Version : "v1" ,
@@ -297,7 +297,7 @@ func TestLookupResourceScope(t *testing.T) {
297
297
crds : []* unstructured.Unstructured {
298
298
testutil .Unstructured (t , testCRDv2 ),
299
299
},
300
- expectedErr : & UnknownTypeError {
300
+ expectedErr : & object. UnknownTypeError {
301
301
GroupVersionKind : schema.GroupVersionKind {
302
302
Group : "example.com" ,
303
303
Version : "v1" ,
@@ -322,7 +322,7 @@ func TestLookupResourceScope(t *testing.T) {
322
322
mapper , err := tf .ToRESTMapper ()
323
323
require .NoError (t , err )
324
324
325
- scope , err := LookupResourceScope (tc .resource , tc .crds , mapper )
325
+ scope , err := object . LookupResourceScope (tc .resource , tc .crds , mapper )
326
326
327
327
if tc .expectedErr != nil {
328
328
require .Equal (t , tc .expectedErr , err )
0 commit comments