@@ -374,7 +374,9 @@ func fetchAllLogsInBucketSince(ctx *E2ETestContext, since time.Time) ([]*ParsedL
374374 return fetchLogsFromPrefix (ctx .S3Client , ctx .DestinationBucket , "" , since )
375375}
376376
377- // fetchLogsFromPrefix fetches and parses all log records from a specific prefix since a given time
377+ // fetchLogsFromPrefix fetches and parses all log records from a specific prefix since a given time.
378+ // Verifies that records within each log object are in chronological order.
379+ // Returns all records combined across objects (no ordering guarantee across objects).
378380func fetchLogsFromPrefix (client * s3.Client , bucket , prefix string , since time.Time ) ([]* ParsedLogRecord , error ) {
379381 objectKeys , err := findLogObjectsSince (client , bucket , prefix , since )
380382 if err != nil {
@@ -389,6 +391,15 @@ func fetchLogsFromPrefix(client *s3.Client, bucket, prefix string, since time.Ti
389391 }
390392
391393 records := parseLogContent (content )
394+
395+ // Verify chronological order within this object
396+ for i := 1 ; i < len (records ); i ++ {
397+ if records [i ].Time .Before (records [i - 1 ].Time ) {
398+ return nil , fmt .Errorf ("object %s: logs not in chronological order: record %d (%v) is before record %d (%v)" ,
399+ key , i , records [i ].Time , i - 1 , records [i - 1 ].Time )
400+ }
401+ }
402+
392403 allRecords = append (allRecords , records ... )
393404 }
394405
@@ -420,7 +431,7 @@ func waitForLogCount(ctx *E2ETestContext, expectedCount int) []*ParsedLogRecord
420431 return waitForLogCountWithPrefix (ctx , ctx .LogPrefix , expectedCount )
421432}
422433
423- // VerifyLogs waits for logs, verifies they match expected values, and checks chronological order .
434+ // VerifyLogs waits for logs and verifies they match expected values.
424435// Returns the logs for additional assertions if needed.
425436func (ctx * E2ETestContext ) VerifyLogs (expected ... ExpectedLogBuilder ) []* ParsedLogRecord {
426437 GinkgoHelper ()
@@ -431,8 +442,6 @@ func (ctx *E2ETestContext) VerifyLogs(expected ...ExpectedLogBuilder) []*ParsedL
431442 verifyLogRecord (logs [i ], exp )
432443 }
433444
434- verifyChronologicalOrder (logs )
435-
436445 return logs
437446}
438447
@@ -513,18 +522,6 @@ func verifyLogRecord(actual *ParsedLogRecord, expected ExpectedLogBuilder) {
513522 }
514523}
515524
516- // verifyChronologicalOrder verifies logs are in chronological order
517- func verifyChronologicalOrder (records []* ParsedLogRecord ) {
518- GinkgoHelper ()
519-
520- for i := 1 ; i < len (records ); i ++ {
521- Expect (records [i ].Time .After (records [i - 1 ].Time ) ||
522- records [i ].Time .Equal (records [i - 1 ].Time )).To (BeTrue (),
523- "Logs should be in chronological order: record %d (%v) should be after or equal to record %d (%v)" ,
524- i , records [i ].Time , i - 1 , records [i - 1 ].Time )
525- }
526- }
527-
528525// verifyLogKeys verifies that logs contain exactly the expected keys with no duplicates.
529526// It filters logs by bucket and keyPrefix, then checks:
530527// - Each matching log has the expected operation
0 commit comments