Skip to content

Commit 388ce53

Browse files
committed
Increase duration to test progress reporter
1 parent 049f5b6 commit 388ce53

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mithril-client-cli/src/utils/progress_reporter.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ mod tests {
237237
fn check_seconds_left_and_elapsed_time_are_used_by_the_formatter() {
238238
// 4 steps
239239
let progress_bar = ProgressBar::new(4);
240-
// 1 step done in 15 ms, left 45ms to finish the 4th steps
241-
sleep(Duration::from_millis(15));
240+
// 1 step done in 150 ms, left 450ms to finish the 4th steps
241+
sleep(Duration::from_millis(150));
242242
progress_bar.set_position(1);
243243

244244
let json_string = ProgressBarJsonFormatter::format(&progress_bar);
@@ -247,19 +247,19 @@ mod tests {
247247
let milliseconds_elapsed = progress_bar.elapsed().as_millis();
248248

249249
// Milliseconds in json may not be exactly the same as the one we get because of the test duration.
250-
// We need to have a difference not more than 4ms to keep the same 2 first milliseconds digits.
251-
let delta = 4;
250+
// We need to have a difference not more than 49ms to keep the same 1 first milliseconds digits.
251+
let delta = 49;
252252

253-
assert!(((45 - delta)..=(45 + delta)).contains(&milliseconds_left));
253+
assert!(((450 - delta)..=(450 + delta)).contains(&milliseconds_left));
254254
assert!(
255-
json_string.contains(r#""seconds_left": 0.04"#), // Should be close to 0.045
255+
json_string.contains(r#""seconds_left": 0.4"#), // Should be close to 0.450
256256
"Not expected value in json output: {}",
257257
json_string
258258
);
259259

260-
assert!(((15 - delta)..(15 + delta)).contains(&milliseconds_elapsed));
260+
assert!(((150 - delta)..(150 + delta)).contains(&milliseconds_elapsed));
261261
assert!(
262-
json_string.contains(r#""seconds_elapsed": 0.01"#), // Should be close to 0.015
262+
json_string.contains(r#""seconds_elapsed": 0.1"#), // Should be close to 0.150
263263
"Not expected value in json output: {}",
264264
json_string
265265
);

0 commit comments

Comments
 (0)