Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit c695776

Browse files
killianmuldoontogashidm
authored andcommitted
Fix ineffassign error in test file
golangci-lint is not picking up on some linting errors in the testing files on creation of a new Pull Request. This fixes a linting issue found by the ineffassign linter.
1 parent 8b03fbc commit c695776

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

telemetry-aware-scheduling/pkg/strategies/deschedule/enforce_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,19 @@ func TestDescheduleStrategy_Enforce(t *testing.T) {
4848
}
4949
for _, tt := range tests {
5050
err := tt.args.cache.WriteMetric("memory", metrics.NodeMetricsInfo{"node-1": {Timestamp: time.Now(), Window: 1, Value: *resource.NewQuantity(100, resource.DecimalSI)}})
51+
if err != nil {
52+
t.Errorf("Cannot write metric to mock cach for test: %v", err)
53+
}
5154
_, err = tt.args.enforcer.KubeClient.CoreV1().Nodes().Create(context.TODO(), tt.node, metav1.CreateOptions{})
55+
if err != nil {
56+
t.Errorf("Cannot write metric to mock cach for test: %v", err)
57+
}
58+
5259
tt.args.enforcer.RegisterStrategyType(tt.d)
5360
tt.args.enforcer.AddStrategy(tt.d, tt.d.StrategyType())
5461
t.Run(tt.name, func(t *testing.T) {
5562
got := []string{}
56-
if _, err = tt.d.Enforce(tt.args.enforcer, tt.args.cache); (err != nil) != tt.wantErr {
63+
if _, err := tt.d.Enforce(tt.args.enforcer, tt.args.cache); (err != nil) != tt.wantErr {
5764
t.Errorf("Strategy.Enforce() error = %v, wantErr %v", err, tt.wantErr)
5865
}
5966
labelledNodes, err := tt.args.enforcer.KubeClient.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: "deschedule-test=violating"})

0 commit comments

Comments
 (0)