@@ -451,7 +451,7 @@ func (f *testFixture) setWorkloadState(pods map[string]map[string]interface{}, r
451
451
// if deployment does not exist - add it.
452
452
res , err := f .k8sClient .AppsV1 ().Deployments ("default" ).Get (context .TODO (), "function-deployment" , metaV1.GetOptions {})
453
453
if err != nil || res == nil {
454
- repl := int32 (len (pods ))
454
+ repl := int32 (len (pods )) //nolint:gosec // explanation: casting len to int64 for API compatibility
455
455
deployment := & appsV1.Deployment {
456
456
ObjectMeta : metaV1.ObjectMeta {
457
457
Name : "function-deployment" ,
@@ -628,31 +628,31 @@ func (f *testFixture) setCurrentData(vals map[string]map[string]float64) {
628
628
}
629
629
630
630
// comparePlans compares two planes and returns false if they are not the same.
631
- func comparePlans (old []map [string ]interface {}, new []planner.Action ) bool {
632
- if len (new ) != len (old ) {
631
+ func comparePlans (onePlan []map [string ]interface {}, anotherPlan []planner.Action ) bool {
632
+ if len (anotherPlan ) != len (onePlan ) {
633
633
return false
634
634
}
635
635
var oldPlan []planner.Action
636
- for _ , entry := range old {
636
+ for _ , entry := range onePlan {
637
637
tmp := planner.Action {
638
638
Name : entry ["name" ].(string ),
639
639
Properties : entry ["properties" ],
640
640
}
641
641
oldPlan = append (oldPlan , tmp )
642
642
}
643
643
for i , item := range oldPlan {
644
- if item .Name != new [i ].Name {
645
- klog .Infof ("Expected action name: %v - got %v" , item .Name , new [i ].Name )
644
+ if item .Name != anotherPlan [i ].Name {
645
+ klog .Infof ("Expected action name: %v - got %v" , item .Name , anotherPlan [i ].Name )
646
646
return false
647
647
}
648
648
one := fmt .Sprintf ("%v" , item .Properties )
649
- another := fmt .Sprintf ("%v" , new [i ].Properties )
649
+ another := fmt .Sprintf ("%v" , anotherPlan [i ].Properties )
650
650
if one != another && item .Name != "rmPod" {
651
651
klog .Infof ("Expected property: %v - got %v" , one , another )
652
652
return false
653
653
} else if item .Name == "rmPod" {
654
654
if one != another && len (one ) == len (another ) {
655
- klog .Warningf ("Not super sure - but looks ok: %v - %v" , item .Properties , new [i ].Properties )
655
+ klog .Warningf ("Not super sure - but looks ok: %v - %v" , item .Properties , anotherPlan [i ].Properties )
656
656
} else if one != another {
657
657
klog .Infof ("This does not look right; expected: %v - got %v" , one , another )
658
658
return false
0 commit comments