@@ -31,7 +31,6 @@ import (
31
31
"golang.org/x/net/context"
32
32
33
33
corev1 "k8s.io/api/core/v1"
34
- v1 "k8s.io/api/core/v1"
35
34
"k8s.io/apimachinery/pkg/api/resource"
36
35
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
37
36
"k8s.io/apimachinery/pkg/runtime"
@@ -182,7 +181,7 @@ func TestUpdateNodeObject(t *testing.T) {
182
181
183
182
expectedCapacity := testNode .Status .Capacity .DeepCopy ()
184
183
for k , v := range featureExtResources {
185
- expectedCapacity [v1 .ResourceName (k )] = resource .MustParse (v )
184
+ expectedCapacity [corev1 .ResourceName (k )] = resource .MustParse (v )
186
185
}
187
186
188
187
// Get the node
@@ -197,7 +196,7 @@ func TestUpdateNodeObject(t *testing.T) {
197
196
198
197
Convey ("When I fail to patch a node" , func () {
199
198
fakeCli .CoreV1 ().(* fakecorev1client.FakeCoreV1 ).PrependReactor ("patch" , "nodes" , func (action clienttesting.Action ) (handled bool , ret runtime.Object , err error ) {
200
- return true , & v1 .Node {}, errors .New ("Fake error when patching node" )
199
+ return true , & corev1 .Node {}, errors .New ("Fake error when patching node" )
201
200
})
202
201
err := fakeMaster .updateNodeObject (fakeCli , testNode , nil , featureAnnotations , ExtendedResources {"" : "" }, nil )
203
202
@@ -244,7 +243,7 @@ func TestUpdateMasterNode(t *testing.T) {
244
243
fakeErr := errors .New ("Fake error when patching node" )
245
244
fakeCli := fakeclient .NewSimpleClientset (testNode )
246
245
fakeCli .CoreV1 ().(* fakecorev1client.FakeCoreV1 ).PrependReactor ("patch" , "nodes" , func (action clienttesting.Action ) (handled bool , ret runtime.Object , err error ) {
247
- return true , & v1 .Node {}, fakeErr
246
+ return true , & corev1 .Node {}, fakeErr
248
247
})
249
248
fakeMaster := newFakeMaster (WithKubernetesClient (fakeCli ))
250
249
@@ -391,7 +390,7 @@ func TestSetLabels(t *testing.T) {
391
390
392
391
fakeErr := errors .New ("Fake error when patching node" )
393
392
fakeCli .CoreV1 ().(* fakecorev1client.FakeCoreV1 ).PrependReactor ("patch" , "nodes" , func (action clienttesting.Action ) (handled bool , ret runtime.Object , err error ) {
394
- return true , & v1 .Node {}, fakeErr
393
+ return true , & corev1 .Node {}, fakeErr
395
394
})
396
395
_ , err := fakeMaster .SetLabels (ctx , req )
397
396
Convey ("An error should be returned" , func () {
@@ -416,8 +415,8 @@ func TestFilterLabels(t *testing.T) {
416
415
fakeMaster := newFakeMaster ()
417
416
fakeMaster .config .ExtraLabelNs = map [string ]struct {}{"example.io" : {}}
418
417
fakeMaster .deniedNs = deniedNs {
419
- normal : map [string ]struct {}{"" : struct {}{} , "kubernetes.io" : struct {}{} , "denied.ns" : struct {} {}},
420
- wildcard : map [string ]struct {}{".kubernetes.io" : struct {}{} , ".denied.subns" : struct {} {}},
418
+ normal : map [string ]struct {}{"" : {} , "kubernetes.io" : {} , "denied.ns" : {}},
419
+ wildcard : map [string ]struct {}{".kubernetes.io" : {} , ".denied.subns" : {}},
421
420
}
422
421
423
422
type TC struct {
@@ -430,19 +429,19 @@ func TestFilterLabels(t *testing.T) {
430
429
}
431
430
432
431
tcs := []TC {
433
- TC {
432
+ {
434
433
description : "Static value" ,
435
434
labelName : "example.io/test" ,
436
435
labelValue : "test-val" ,
437
436
expectedValue : "test-val" ,
438
437
},
439
- TC {
438
+ {
440
439
description : "Dynamic value" ,
441
440
labelName : "example.io/testLabel" ,
442
441
labelValue : "@test.feature.LSM" ,
443
442
features : nfdv1alpha1.Features {
444
443
Attributes : map [string ]nfdv1alpha1.AttributeFeatureSet {
445
- "test.feature" : nfdv1alpha1. AttributeFeatureSet {
444
+ "test.feature" : {
446
445
Elements : map [string ]string {
447
446
"LSM" : "123" ,
448
447
},
@@ -451,31 +450,31 @@ func TestFilterLabels(t *testing.T) {
451
450
},
452
451
expectedValue : "123" ,
453
452
},
454
- TC {
453
+ {
455
454
description : "Unprefixed should be denied" ,
456
455
labelName : "test-label" ,
457
456
labelValue : "test-value" ,
458
457
expectErr : true ,
459
458
},
460
- TC {
459
+ {
461
460
description : "kubernetes.io ns should be denied" ,
462
461
labelName : "kubernetes.io/test-label" ,
463
462
labelValue : "test-value" ,
464
463
expectErr : true ,
465
464
},
466
- TC {
465
+ {
467
466
description : "*.kubernetes.io ns should be denied" ,
468
467
labelName : "sub.ns.kubernetes.io/test-label" ,
469
468
labelValue : "test-value" ,
470
469
expectErr : true ,
471
470
},
472
- TC {
471
+ {
473
472
description : "denied.ns ns should be denied" ,
474
473
labelName : "denied.ns/test-label" ,
475
474
labelValue : "test-value" ,
476
475
expectErr : true ,
477
476
},
478
- TC {
477
+ {
479
478
description : "*.denied.subns ns should be denied" ,
480
479
labelName : "my.denied.subns/test-label" ,
481
480
labelValue : "test-value" ,
@@ -848,7 +847,7 @@ func TestGetDynamicValue(t *testing.T) {
848
847
value : "@test.feature.LSM" ,
849
848
features : & nfdv1alpha1.Features {
850
849
Attributes : map [string ]nfdv1alpha1.AttributeFeatureSet {
851
- "test.feature" : nfdv1alpha1. AttributeFeatureSet {
850
+ "test.feature" : {
852
851
Elements : map [string ]string {
853
852
"LSM" : "123" ,
854
853
},
0 commit comments