deps: update Go to v1.24.2 (#3750)

* deps: update Go to v1.24.2
* tests: replace context.Background() with t.Context()

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2025-04-09 10:54:28 +02:00 committed by GitHub
parent a7f9561a3d
commit 4e5c213b4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
112 changed files with 287 additions and 316 deletions

View file

@ -98,7 +98,7 @@ func TestGetNodeImage(t *testing.T) {
getErr: tc.getScaleSetVMErr,
},
}
gotImage, err := client.GetNodeImage(context.Background(), tc.providerID)
gotImage, err := client.GetNodeImage(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -131,7 +131,7 @@ func TestGetScalingGroupID(t *testing.T) {
require := require.New(t)
client := Client{}
gotScalingGroupID, err := client.GetScalingGroupID(context.Background(), tc.providerID)
gotScalingGroupID, err := client.GetScalingGroupID(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -262,7 +262,7 @@ func TestCreateNode(t *testing.T) {
var createErr error
go func() {
defer wg.Done()
gotNodeName, gotProviderID, createErr = client.CreateNode(context.Background(), tc.scalingGroupID)
gotNodeName, gotProviderID, createErr = client.CreateNode(t.Context(), tc.scalingGroupID)
}()
// want error before PollUntilDone is called
@ -319,7 +319,7 @@ func TestDeleteNode(t *testing.T) {
client := Client{
scaleSetsAPI: &stubScaleSetsAPI{deleteErr: tc.deleteErr},
}
err := client.DeleteNode(context.Background(), tc.providerID)
err := client.DeleteNode(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -343,25 +343,25 @@ func TestCapacityPollingHandler(t *testing.T) {
},
wantedCapacity: wantCapacity,
}
assert.NoError(handler.Poll(context.Background()))
assert.NoError(handler.Poll(t.Context()))
assert.False(handler.Done())
// Calling Result early should error
assert.Error(handler.Result(context.Background(), &gotCapacity))
assert.Error(handler.Result(t.Context(), &gotCapacity))
// let scaleSet API error
handler.scaleSetsAPI.(*stubScaleSetsAPI).getErr = errors.New("get error")
assert.Error(handler.Poll(context.Background()))
assert.Error(handler.Poll(t.Context()))
handler.scaleSetsAPI.(*stubScaleSetsAPI).getErr = nil
// let scaleSet API return invalid SKU
handler.scaleSetsAPI.(*stubScaleSetsAPI).scaleSet.SKU = nil
assert.Error(handler.Poll(context.Background()))
assert.Error(handler.Poll(t.Context()))
// let Poll finish
handler.scaleSetsAPI.(*stubScaleSetsAPI).scaleSet.SKU = &armcompute.SKU{Capacity: to.Ptr(wantCapacity)}
assert.NoError(handler.Poll(context.Background()))
assert.NoError(handler.Poll(t.Context()))
assert.True(handler.Done())
assert.NoError(handler.Result(context.Background(), &gotCapacity))
assert.NoError(handler.Result(t.Context(), &gotCapacity))
assert.Equal(wantCapacity, gotCapacity)
}

View file

@ -7,7 +7,6 @@ SPDX-License-Identifier: AGPL-3.0-only
package client
import (
"context"
"errors"
"net/http"
"testing"
@ -67,7 +66,7 @@ func TestGetNodeState(t *testing.T) {
instanceViewErr: tc.getInstanceViewErr,
},
}
gotState, err := client.GetNodeState(context.Background(), tc.providerID)
gotState, err := client.GetNodeState(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return

View file

@ -7,7 +7,6 @@ SPDX-License-Identifier: AGPL-3.0-only
package client
import (
"context"
"errors"
"testing"
@ -103,7 +102,7 @@ func TestGetScalingGroupImage(t *testing.T) {
getErr: tc.getScaleSetErr,
},
}
gotImage, err := client.GetScalingGroupImage(context.Background(), tc.scalingGroupID)
gotImage, err := client.GetScalingGroupImage(t.Context(), tc.scalingGroupID)
if tc.wantErr {
assert.Error(err)
return
@ -155,7 +154,7 @@ func TestSetScalingGroupImage(t *testing.T) {
resultErr: tc.resultErr,
},
}
err := client.SetScalingGroupImage(context.Background(), tc.scalingGroupID, tc.imageURI)
err := client.SetScalingGroupImage(t.Context(), tc.scalingGroupID, tc.imageURI)
if tc.wantErr {
assert.Error(err)
return
@ -291,7 +290,7 @@ func TestListScalingGroups(t *testing.T) {
},
},
}
gotGroups, err := client.ListScalingGroups(context.Background(), "uid")
gotGroups, err := client.ListScalingGroups(t.Context(), "uid")
if tc.wantErr {
assert.Error(err)
return