Skip to content

Commit

Permalink
Change to context.Background() in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbenjemaa committed Nov 28, 2023
1 parent 1da5a86 commit 2762c20
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/alpha/rollout_pauser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func Test_ObjectPauser(t *testing.T) {
}
g.Expect(err).ToNot(HaveOccurred())
for _, obj := range tt.fields.objs {
cl, err := proxy.NewClient(context.TODO())
cl, err := proxy.NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())
key := client.ObjectKeyFromObject(obj)
switch obj.(type) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/alpha/rollout_restarter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func Test_ObjectRestarter(t *testing.T) {
}
g.Expect(err).ToNot(HaveOccurred())
for _, obj := range tt.fields.objs {
cl, err := proxy.NewClient(context.TODO())
cl, err := proxy.NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())
key := client.ObjectKeyFromObject(obj)
switch obj.(type) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/alpha/rollout_resumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func Test_ObjectResumer(t *testing.T) {
}
g.Expect(err).ToNot(HaveOccurred())
for _, obj := range tt.fields.objs {
cl, err := proxy.NewClient(context.TODO())
cl, err := proxy.NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())
key := client.ObjectKeyFromObject(obj)
switch obj.(type) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/alpha/rollout_rollbacker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func Test_ObjectRollbacker(t *testing.T) {
return
}
g.Expect(err).ToNot(HaveOccurred())
cl, err := proxy.NewClient(context.TODO())
cl, err := proxy.NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())
key := client.ObjectKeyFromObject(deployment)
md := &clusterv1.MachineDeployment{}
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterctl/client/cluster/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func Test_providerComponents_Delete(t *testing.T) {

g.Expect(err).ToNot(HaveOccurred())

cs, err := proxy.NewClient(context.TODO())
cs, err := proxy.NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())

for _, want := range tt.wantDiff {
Expand Down Expand Up @@ -322,7 +322,7 @@ func Test_providerComponents_DeleteCoreProviderWebhookNamespace(t *testing.T) {
}

proxy := test.NewFakeProxy().WithObjs(initObjs...)
proxyClient, _ := proxy.NewClient(context.TODO())
proxyClient, _ := proxy.NewClient(context.Background())
var nsList corev1.NamespaceList

// assert length before deleting
Expand Down Expand Up @@ -457,7 +457,7 @@ func Test_providerComponents_Create(t *testing.T) {

g.Expect(err).ToNot(HaveOccurred())

cs, err := proxy.NewClient(context.TODO())
cs, err := proxy.NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())

for _, item := range tt.want {
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/cluster/crd_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func Test_CRDMigrator(t *testing.T) {
objs = append(objs, &tt.CRs[i])
}

c, err := test.NewFakeProxy().WithObjs(objs...).NewClient(context.TODO())
c, err := test.NewFakeProxy().WithObjs(objs...).NewClient(context.Background())
g.Expect(err).ToNot(HaveOccurred())
countingClient := newUpgradeCountingClient(c)

Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/tree/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ func Test_Discovery(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)

client, err := test.NewFakeProxy().WithObjs(tt.args.objs...).NewClient(context.TODO())
client, err := test.NewFakeProxy().WithObjs(tt.args.objs...).NewClient(context.Background())
g.Expect(client).ToNot(BeNil())
g.Expect(err).ToNot(HaveOccurred())

Expand Down

0 comments on commit 2762c20

Please sign in to comment.