fix: preserve cross-pod message order
This commit is contained in:
@@ -148,6 +148,43 @@ func TestRunMergeReportsSameClockDeliveryLatency(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunMergeTreatsLateSuccessAsFinalAcceptance(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
late := AgentSummary{
|
||||
RunID: "run1", Scenario: "group", Machine: "a", ExpectedConnections: 1, ReadyConnections: 1,
|
||||
PublishAttempted: 1, PublishAccepted: 0, CtrlTrackingEnabled: true,
|
||||
PublishCtrlObserved: 1, PublishLateCtrl: 1, PublishCtrlUnresolved: 0,
|
||||
PublishErrors: map[string]int64{"ctrl_timeout": 1},
|
||||
CtrlObservationSamples: []CtrlObservationSample{{Code: 202, Late: true}},
|
||||
Errors: []string{"publish message-1: ctrl timeout id=pub-a-1"},
|
||||
}
|
||||
timely := AgentSummary{
|
||||
RunID: "run1", Scenario: "group", Machine: "b", ExpectedConnections: 1, ReadyConnections: 1,
|
||||
PublishAttempted: 1, PublishAccepted: 1, CtrlTrackingEnabled: true,
|
||||
PublishCtrlObserved: 1, PublishErrors: map[string]int64{},
|
||||
}
|
||||
aPath, bPath, reportPath := filepath.Join(dir, "a.json"), filepath.Join(dir, "b.json"), filepath.Join(dir, "report.json")
|
||||
writeSummaryForTest(t, aPath, late)
|
||||
writeSummaryForTest(t, bPath, timely)
|
||||
if err := runMerge(aPath, bPath, reportPath); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var report CombinedReport
|
||||
raw, err := os.ReadFile(reportPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = json.Unmarshal(raw, &report); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if report.PublishAccepted != 1 || report.PublishLateAccepted != 1 || report.PublishFinalAccepted != 2 || report.PublishSuccessRate != 1 {
|
||||
t.Fatalf("late acceptance was not included in final publish outcome: %+v", report)
|
||||
}
|
||||
if !report.Passed || len(report.FailureReasons) != 0 {
|
||||
t.Fatalf("resolved late ACK must not fail the report: %+v", report.FailureReasons)
|
||||
}
|
||||
}
|
||||
|
||||
func writeSummaryForTest(t *testing.T, path string, summary AgentSummary) {
|
||||
t.Helper()
|
||||
raw, err := json.Marshal(summary)
|
||||
|
||||
Reference in New Issue
Block a user