Skip to content

Commit a5e1bf4

Browse files
committed
[no-relnote] Fix lint errors
Signed-off-by: Evan Lezar <[email protected]>
1 parent 3cb9e54 commit a5e1bf4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cmd/gpu-feature-discovery/main_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ func TestRunSleep(t *testing.T) {
249249
runRestart, runError = d.run(sigs)
250250
}()
251251

252-
outFileModificationTime := make([]int64, 2)
253-
timestampLabels := make([]string, 2)
252+
var outFileModificationTime []int64
253+
var timestampLabels []string
254254
// Read two iterations of the output file
255-
for i := 0; i < 2; i++ {
255+
for i := range 2 {
256256
outFile, err := waitForFile(*conf.Flags.GFD.OutputFile, 5, time.Second)
257257
require.NoErrorf(t, err, "Open output file: %d", i)
258258

@@ -266,13 +266,13 @@ func TestRunSleep(t *testing.T) {
266266
require.NoError(t, err, "Getting output file info")
267267

268268
ts = outFileStat.ModTime().Unix()
269-
if ts > outFileModificationTime[0] {
269+
if len(outFileModificationTime) == 0 || ts > outFileModificationTime[0] {
270270
break
271271
}
272272
// We wait for conf.SleepInterval, as the labels should be updated at least once in that period
273273
time.Sleep(time.Duration(*conf.Flags.GFD.SleepInterval))
274274
}
275-
outFileModificationTime[i] = ts
275+
outFileModificationTime = append(outFileModificationTime, ts)
276276

277277
output, err := io.ReadAll(outFile)
278278
require.NoErrorf(t, err, "Read output file: %d", i)
@@ -289,7 +289,7 @@ func TestRunSleep(t *testing.T) {
289289
require.NoErrorf(t, err, "Building map of labels from output file: %d", i)
290290

291291
require.Containsf(t, labels, "nvidia.com/gfd.timestamp", "Missing timestamp: %d", i)
292-
timestampLabels[i] = labels["nvidia.com/gfd.timestamp"]
292+
timestampLabels = append(timestampLabels, labels["nvidia.com/gfd.timestamp"])
293293

294294
require.Containsf(t, labels, "nvidia.com/vgpu.present", "Missing vgpu present label: %d", i)
295295
require.Containsf(t, labels, "nvidia.com/vgpu.host-driver-version", "Missing vGPU host driver version label: %d", i)

0 commit comments

Comments
 (0)