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

@ -91,7 +91,7 @@ func TestGetNodeImage(t *testing.T) {
describeInstancesErr: tc.describeInstancesErr,
},
}
gotImage, err := client.GetNodeImage(context.Background(), tc.providerID)
gotImage, err := client.GetNodeImage(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -199,7 +199,7 @@ func TestGetScalingGroupID(t *testing.T) {
describeInstancesErr: tc.describeInstancesErr,
},
}
gotScalingID, err := client.GetScalingGroupID(context.Background(), tc.providerID)
gotScalingID, err := client.GetScalingGroupID(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -357,7 +357,7 @@ func TestCreateNode(t *testing.T) {
setDesiredCapacityErr: tc.setDesiredCapacityErr,
},
}
nodeName, providerID, err := client.CreateNode(context.Background(), tc.providerID)
nodeName, providerID, err := client.CreateNode(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -398,7 +398,7 @@ func TestDeleteNode(t *testing.T) {
terminateInstanceErr: tc.terminateInstanceErr,
},
}
err := client.DeleteNode(context.Background(), tc.providerID)
err := client.DeleteNode(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"
@ -161,7 +160,7 @@ func TestGetNodeState(t *testing.T) {
describeInstanceStatusErr: tc.describeInstanceStatusErr,
},
}
nodeState, err := client.GetNodeState(context.Background(), tc.providerID)
nodeState, err := client.GetNodeState(t.Context(), tc.providerID)
assert.Equal(tc.wantState, nodeState)
if tc.wantErr {
assert.Error(err)

View file

@ -7,7 +7,6 @@ SPDX-License-Identifier: AGPL-3.0-only
package client
import (
"context"
"testing"
"github.com/aws/aws-sdk-go-v2/service/autoscaling"
@ -91,7 +90,7 @@ func TestGetScalingGroupImage(t *testing.T) {
},
},
}
scalingGroupImage, err := client.GetScalingGroupImage(context.Background(), tc.providerID)
scalingGroupImage, err := client.GetScalingGroupImage(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -216,7 +215,7 @@ func TestSetScalingGroupImage(t *testing.T) {
},
},
}
err := client.SetScalingGroupImage(context.Background(), tc.providerID, tc.imageURI)
err := client.SetScalingGroupImage(t.Context(), tc.providerID, tc.imageURI)
if tc.wantErr {
assert.Error(err)
return
@ -319,7 +318,7 @@ func TestListScalingGroups(t *testing.T) {
describeAutoScalingGroupsErr: tc.describeAutoScalingGroupsErr,
},
}
gotGroups, err := client.ListScalingGroups(context.Background(), tc.providerID)
gotGroups, err := client.ListScalingGroups(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return

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

View file

@ -7,7 +7,6 @@ SPDX-License-Identifier: AGPL-3.0-only
package client
import (
"context"
"errors"
"math/rand"
"testing"
@ -101,7 +100,7 @@ func TestGetNodeImage(t *testing.T) {
disk: tc.disk,
},
}
gotImage, err := client.GetNodeImage(context.Background(), tc.providerID)
gotImage, err := client.GetNodeImage(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -162,7 +161,7 @@ func TestGetScalingGroupID(t *testing.T) {
instance: &instance,
},
}
gotScalingGroupID, err := client.GetScalingGroupID(context.Background(), tc.providerID)
gotScalingGroupID, err := client.GetScalingGroupID(t.Context(), tc.providerID)
if tc.wantErr {
assert.Error(err)
return
@ -221,7 +220,7 @@ func TestCreateNode(t *testing.T) {
},
prng: rand.New(rand.NewSource(int64(time.Now().Nanosecond()))),
}
instanceName, providerID, err := client.CreateNode(context.Background(), tc.scalingGroupID)
instanceName, providerID, err := client.CreateNode(t.Context(), tc.scalingGroupID)
if tc.wantErr {
assert.Error(err)
return
@ -287,7 +286,7 @@ func TestDeleteNode(t *testing.T) {
},
},
}
err := client.DeleteNode(context.Background(), tc.providerID)
err := client.DeleteNode(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"
"net/http"
"testing"
@ -108,7 +107,7 @@ func TestGetNodeState(t *testing.T) {
},
},
}
nodeState, err := client.GetNodeState(context.Background(), tc.providerID)
nodeState, 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"
@ -57,7 +56,7 @@ func TestCanonicalProjectID(t *testing.T) {
getErr: tc.getProjectErr,
},
}
gotID, err := client.canonicalProjectID(context.Background(), tc.projectID)
gotID, err := client.canonicalProjectID(t.Context(), tc.projectID)
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"
@ -96,7 +95,7 @@ func TestGetScalingGroupImage(t *testing.T) {
template: tc.instanceTemplate,
},
}
gotImage, err := client.GetScalingGroupImage(context.Background(), tc.scalingGroupID)
gotImage, err := client.GetScalingGroupImage(t.Context(), tc.scalingGroupID)
if tc.wantErr {
assert.Error(err)
return
@ -281,7 +280,7 @@ func TestSetScalingGroupImage(t *testing.T) {
template: tc.instanceTemplate,
},
}
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
@ -456,7 +455,7 @@ func TestListScalingGroups(t *testing.T) {
getErr: tc.templateGetErr,
},
}
gotGroups, err := client.ListScalingGroups(context.Background(), "uid")
gotGroups, err := client.ListScalingGroups(t.Context(), "uid")
if tc.wantErr {
assert.Error(err)
return