summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin Song <4605384+chipbuster@users.noreply.github.com>2022-01-22 05:54:04 -0600
committerGitHub <noreply@github.com>2022-01-22 12:54:04 +0100
commit08b5ad94fd9d07437712c1eed7b264eb3e505941 (patch)
tree382fda8635e64e1dcdd6ced50cf080dc08158724 /src
parent31ab8aa0c58f18fdbcd113cef260c90cd7ce2726 (diff)
ci: Fix aws::expiration_date_set_from_file race (#3484)
* ci: Fix aws::expiration_date_set_from_file race While aws::expiration_date_set_from_file will almost-always work perfectly locally, it is theoretically possible for the thread running the test to be scheduled away betwen writing the file with timing information and then actually reading it, resulting in a shorter-than-expected time appearing in the module. This can also happen if the test triggers right at the very end of a second (e.g. at 10:45:47.999995). This appears to actually happen sometimes on heavily-loaded GitHub Actions runners. To fix this issue, we allow for up to a two-second delay between when the file is written and when the test actually fires (allowing "30m", "29m59s", and "29m58s" as possible values). * Fix typo
Diffstat (limited to 'src')
-rw-r--r--src/modules/aws.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/modules/aws.rs b/src/modules/aws.rs
index 97bbbac4a..95e31f2fa 100644
--- a/src/modules/aws.rs
+++ b/src/modules/aws.rs
@@ -554,14 +554,19 @@ expiration={}
credentials_path.to_string_lossy().as_ref(),
)
.collect();
- let expected = Some(format!(
- "on {}",
- Color::Yellow
- .bold()
- .paint("☁️ astronauts (ap-northeast-2) [30m]")
- ));
- assert_eq!(expected, actual);
+ // In principle, "30m" should be correct. However, bad luck in scheduling
+ // on shared runners may delay it. Allow for up to 2 seconds of delay.
+ let possible_values = ["30m", "29m59s", "29m58s"];
+ let possible_values = possible_values.map(|duration| {
+ let segment_colored = format!("☁️ astronauts (ap-northeast-2) [{}]", duration);
+ Some(format!(
+ "on {}",
+ Color::Yellow.bold().paint(segment_colored)
+ ))
+ });
+
+ assert!(possible_values.contains(&actual));
dir.close()
}