Skip to content

Commit 60a1df2

Browse files
authored
Merge pull request #5779 from damdo/fix-e2e-postprocesslog-panic
🌱 fix: e2e test: validate inputData during log postprocessing to avoid panic
2 parents 6460ac1 + 7f4c07d commit 60a1df2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/e2e/shared/common.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ func postProcessBase64LogData(dir, src, dst string) error {
312312
}
313313

314314
// Extract second line which contains the data (first line contains the command)
315-
inputStringData := strings.Split(string(inputData), "\n")[1]
315+
inputDataLines := strings.Split(string(inputData), "\n")
316+
if len(inputDataLines) < 2 {
317+
return errors.Errorf("source file %q does not contain expected data (need at least 2 lines, got %d), input data content: %q", sourceFile, len(inputDataLines), string(inputData))
318+
}
319+
inputStringData := inputDataLines[1]
316320

317321
// Trim spaces and the $ suffix.
318322
inputStringData = strings.TrimSpace(inputStringData)

0 commit comments

Comments
 (0)