Skip to content

Commit 7f106f5

Browse files
committed
Address PR remarks
1 parent 54a02e2 commit 7f106f5

2 files changed

Lines changed: 10 additions & 27 deletions

File tree

test/integration/lke_clusters_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/linode/linodego/v2"
1111
k8scondition "github.com/linode/linodego/v2/k8s/pkg/condition"
12+
"github.com/stretchr/testify/require"
1213
)
1314

1415
func TestLKECluster_GetMissing(t *testing.T) {
@@ -93,9 +94,7 @@ func TestLKECluster_Enterprise_BYOVPC_smoke(t *testing.T) {
9394
linodego.CapabilityDiskEncryption,
9495
linodego.CapabilityKubernetesEnterprise,
9596
})
96-
if len(regions) < 1 {
97-
t.Fatal("No regions with required capabilities found")
98-
}
97+
require.Greater(t, len(regions), 0, "Error getting regions with required capabilities")
9998

10099
region := regions[0]
101100
vpc, vpcTeardown, err := createVPC(t, client, []vpcModifier{func(l *linodego.Client, options *linodego.VPCCreateOptions) {
@@ -106,9 +105,7 @@ func TestLKECluster_Enterprise_BYOVPC_smoke(t *testing.T) {
106105
},
107106
}
108107
}}...)
109-
if err != nil {
110-
t.Errorf("Error creating VPC, GOT ERROR %v", err)
111-
}
108+
require.NoErrorf(t, err, "Error creating VPC, got: %v", err)
112109

113110
client, lkeCluster, teardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) {
114111
createOpts.Tier = "enterprise"

test/integration/volumes_test.go

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ func TestVolume_Create_withEncryption(t *testing.T) {
6565
}
6666

6767
volume, err = client.WaitForVolumeStatus(ctx, volume.ID, linodego.VolumeActive)
68-
if err != nil {
69-
t.Errorf("Error waiting for volume to be active: %v", err)
70-
}
68+
require.NoErrorf(t, err, "Error waiting for volume to be active: %v", err)
7169

7270
assertDateSet(t, volume.Created)
7371
assertDateSet(t, volume.Updated)
@@ -90,9 +88,7 @@ func TestVolume_Resize(t *testing.T) {
9088
}
9189

9290
_, err = client.WaitForVolumeStatus(ctx, volume.ID, linodego.VolumeActive)
93-
if err != nil {
94-
t.Errorf("Error waiting for volume to be active, %s", err)
95-
}
91+
require.NoErrorf(t, err, "Error waiting for volume to be active: %v", err)
9692

9793
opts := linodego.VolumeResizeOptions{
9894
Size: volume.Size + 1,
@@ -102,17 +98,13 @@ func TestVolume_Resize(t *testing.T) {
10298
}
10399

104100
volume, err = client.WaitForVolumeStatus(ctx, volume.ID, linodego.VolumeActive)
105-
if err != nil {
106-
t.Errorf("Error waiting for volume to be active: %v", err)
107-
}
101+
require.NoErrorf(t, err, "Error waiting for volume to be active: %v", err)
108102
}
109103

110104
func TestVolumes_List_smoke(t *testing.T) {
111105
client, volume, teardown, err := setupVolume(t, "fixtures/TestVolume_List")
112106
defer teardown()
113-
if err != nil {
114-
t.Errorf("Error setting up volume test, %s", err)
115-
}
107+
require.NoErrorf(t, err, "Error setting up volume test, %s", err)
116108

117109
volumes, err := client.ListVolumes(context.Background(), nil)
118110
if err != nil {
@@ -167,9 +159,7 @@ func TestVolume_Get_withEncryption(t *testing.T) {
167159
}
168160

169161
volume, err = client.WaitForVolumeStatus(ctx, volume.ID, linodego.VolumeActive)
170-
if err != nil {
171-
t.Errorf("Error waiting for volume to be active: %v", err)
172-
}
162+
require.NoErrorf(t, err, "Error waiting for volume to be active: %v", err)
173163

174164
returnedVolume, err := client.GetVolume(context.Background(), volume.ID)
175165
if err != nil {
@@ -180,9 +170,7 @@ func TestVolume_Get_withEncryption(t *testing.T) {
180170
}
181171

182172
volumes, err := client.ListVolumes(context.Background(), nil)
183-
if err != nil {
184-
t.Errorf("Error listing volumes, expected struct, got error %v", err)
185-
}
173+
require.NoErrorf(t, err, "Error listing volumes, expected struct, got error %v", err)
186174
found := false
187175
for _, v := range volumes {
188176
if v.ID == volume.ID {
@@ -310,9 +298,7 @@ func setupVolume(t *testing.T, fixturesYaml string) (*linodego.Client, *linodego
310298
}
311299

312300
volume, err = client.WaitForVolumeStatus(ctx, volume.ID, linodego.VolumeActive)
313-
if err != nil {
314-
t.Errorf("Error waiting for volume to be active: %v", err)
315-
}
301+
require.NoErrorf(t, err, "Error waiting for volume to be active: %v", err)
316302

317303
teardown := func() {
318304
// volumes deleted too fast tend to stick, adding a few seconds to catch up

0 commit comments

Comments
 (0)