Skip to content

Commit 849ec36

Browse files
committed
Addressing PR remarks
1 parent 5c5d533 commit 849ec36

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

test/integration/iam_io_ready_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,19 @@ func TestIAM_GetIOReadyForNotAttachedVolume(t *testing.T) {
9898

9999
volumeList, err := client.ListVolumes(context.Background(), nil)
100100
require.NoErrorf(t, err, "Error listing volumes: %v", err)
101+
volumeFound := false
102+
101103
for _, vol := range volumeList {
102104
if vol.ID == volume.ID {
105+
volumeFound = true
103106
assert.Equal(t, linodego.VolumeActive, vol.Status)
104107
assert.Empty(t, vol.LinodeID)
105108
assert.Empty(t, vol.LinodeLabel)
106109
assert.False(t, vol.IOReady)
107110
break
108111
}
109112
}
113+
require.True(t, volumeFound, "Volume with ID %d not found in volumeList", volume.ID)
110114

111115
volume, err = client.GetVolume(context.Background(), volume.ID)
112116
require.NoErrorf(t, err, "Error getting not attached volume: %v", err)
@@ -133,7 +137,7 @@ func TestIAM_GetIOReadyForAttachedDetachedVolume(t *testing.T) {
133137
err = client.DetachVolume(context.Background(), volume.ID)
134138
require.NoErrorf(t, err, "Error detaching volume: %v", err)
135139

136-
volume, err = client.WaitForVolumeIOReadyStatus(context.Background(), volume.ID, false, 45)
140+
_, err = client.WaitForVolumeIOReadyStatus(context.Background(), volume.ID, false, 45)
137141
require.NoErrorf(t, err, "Error waiting for IO Ready status of detached volume: %v", err)
138142

139143
instanceVolumes, err := client.ListInstanceVolumes(context.Background(), instance.ID, nil)

waitfor.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,12 +837,10 @@ func (client Client) WaitForVolumeIOReadyStatus(ctx context.Context, volumeID in
837837
if err != nil {
838838
return volume, err
839839
}
840-
841-
complete := (volume.IOReady == status)
842-
843-
if complete {
840+
if volume.IOReady == status {
844841
return volume, nil
845842
}
843+
846844
case <-ctx.Done():
847845
return nil, fmt.Errorf("failed to wait for Volume %d IO Ready status %t: %w", volumeID, status, ctx.Err())
848846
}

0 commit comments

Comments
 (0)