test(cli): take the upload time bound before reading the upload

TestOSRecoverySkipSurvivesDebugTruncation passed time.Now() as the
argument after readLogReader, and Go evaluates arguments left to right,
so the lower bound was taken after the upload header was rendered. The
header check failed whenever a second boundary fell between the two:

    header time = 11:13:44, want a time between 11:13:45.007 and now

Take the bound first, as the other splitUpload callers do.
This commit is contained in:
Cuong Manh Le committed 2026-10-06 14:53:33 +07:00
1 parent 5978ddfe35
commit 806683d727
1 file changed
+5 -1
+5 -1
View File
@@ -137,7 +137,11 @@ func TestOSRecoverySkipSurvivesDebugTruncation(t *testing.T) {
for range 40 {
mainLog.Load().Debug().Msg(strings.Repeat("debug filler", 20))
}
debugPart, journalPart := splitUpload(t, readLogReader(t, p, false), time.Now())
// Taken before the read renders the upload header: as an argument after
// readLogReader it would be evaluated later, and fail whenever a second
// boundary falls between the two.
start := time.Now()
debugPart, journalPart := splitUpload(t, readLogReader(t, p, false), start)
if strings.Contains(string(debugPart), recoverySkipMessage) {
t.Fatal("fixture did not truncate the skip from debug")
}