tests: Fix time re in all_protocol_startup/test_all_protocol_startup - #21378
Conversation
There was failure in test with diff: - Hello due in 932 usecs + Hello due in XX.XXXs Regular expression expected for format SECONDS.MSECs only. Added `usec` support to regular expression. `ospf_timeval_dump` can also output weeks, days, hours, but probably there is no need to support that. Signed-off-by: Kyrylo Yatsenko <hedrok@gmail.com>
Greptile SummaryThis PR fixes a flaky test failure in Confidence Score: 5/5This PR is safe to merge β it is a minimal, targeted fix to a single test regex with no functional code changes. The change is a single-line regex update in a test file with no ambiguity. The fix correctly handles the usecs branch of ospf_timeval_dump (verified against the source), all other existing format cases (X.XXXs) continue to work, and there are no logic or syntax errors introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["ospf_timeval_dump(t)"] --> B{tv_sec > 0\nor ms > 0?}
B -- Yes --> C["Format: '%ld.%03lus'\ne.g. '12.32s'"]
B -- No --> D["Format: '%ld usecs'\ne.g. '932 usecs'"]
C --> E["Matched by [-0-9\\.]+s\n(original & new regex)"]
D --> F["NOT matched by original regex\n[-0-9\\.]+s"]
F --> G["FIXED: matched by new regex\n[-0-9\\.]+( usec)?s"]
E --> H["Replaced with 'Hello due in XX.XXXs'"]
G --> H
Reviews (1): Last reviewed commit: "tests: Fix time re in all_protocol_start..." | Re-trigger Greptile |
There was failure in test with diff:
Regular expression expected for format SECONDS.MSECs only.
Added
usecsupport to regular expression.ospf_timeval_dumpcan also output weeks, days, hours, but probably there is no need to support that.Or should I add weeks, days, hours just in case?..
I couldn't reproduce failure, but tested regular expression with
Hello due in 932 usecsandHello due in 12.32smanually.Failure URL: https://github.com/FRRouting/frr/pull/21376/checks?check_run_id=68874454155
Full output: