input-output-hk / mithril

Stake-based threshold multi-signatures protocol
https://mithril.network
Apache License 2.0
116 stars 36 forks source link

Stabilize test removing most of the time dependency #1673

Closed sfauvel closed 2 months ago

sfauvel commented 2 months ago

Content

ProgressBar calculates elapsed time and left time using function now. Even we set ProgressBar with hard coded values, we could never be sure what the json looks like. Depending on the machines, the result may not be the same.

For testing, we create a format function that is not time dependent. We create a second test which checks that we send the right parameters to the format function. It doesn't check the exact values but only if they are consistent.

Pre-submit checklist

Issue(s)

Closes #1466

github-actions[bot] commented 2 months ago

Test Results

    3 files  ±0     43 suites  ±0   8m 23s :stopwatch: -12s   979 tests ±0    979 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  1 073 runs  ±0  1 073 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0 

Results for commit 168a7b11. ± Comparison against base commit 57e583ec.

This pull request removes 4 and adds 4 tests. Note that renamed tests count towards both. ``` mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_elapsed_in_json_report_with_less_than_100_milliseconds mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_elapsed_in_json_report_with_more_than_100_milliseconds mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_left_in_json_report_with_less_than_100_milliseconds mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_left_in_json_report_with_more_than_100_milliseconds ``` ``` mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_formatting_in_json_report_with_less_than_100_milliseconds mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_formatting_in_json_report_with_milliseconds_ending_by_zeros mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_formatting_in_json_report_with_more_than_100_milliseconds mithril-client-cli ‑ utils::progress_reporter::tests::check_seconds_left_and_elapsed_time_are_used_by_the_formatter ```

:recycle: This comment has been updated with latest results.