Starting on the 1st of September, generate_and_detect_common_annotated_key_test began failing with:
---- end_to_end_tests::generate_and_detect_common_annotated_key_test stdout ----
thread 'end_to_end_tests::generate_and_detect_common_annotated_key_test' panicked at src\end_to_end_tests.rs:23:49:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
generate_common_annotated_test_key was producing Ok("") since the hard-coded test_char combined with this month happened to generate an invalid key.
The code was hitting the second branch of generate_common_annotated_test_key:
// The HIS v2 standard requires that there be no special characters in the generated key.
if !key.contains('+') && !key.contains('/') {
if !long_form {
key = key.substring(0, key.len() - 4).to_string();
}
return Ok(key);
} else if test_char.is_some() {
// We could not produce a valid test key given the current signature,
// checksum seed, reserved bits and specified test character.
key = String::new();
break;
}
This hardens the test to prevent failing as time changes.
Follow up:
Check in a Cargo.lock to ensure deterministic packages. (This is orthogonal but package non-determinism was one of the (incorrect) hypotheses for the root cause of the failure.)
Consider accepting a timestamp into the API so that it can be made deterministic.
Consider returning Err("…") instead of Some(""), since "" is not a valid test key anyways.
Starting on the 1st of September,
generate_and_detect_common_annotated_key_test
began failing with:generate_common_annotated_test_key
was producingOk("")
since the hard-codedtest_char
combined with this month happened to generate an invalid key.The code was hitting the second branch of
generate_common_annotated_test_key
:This hardens the test to prevent failing as time changes.
Follow up:
Cargo.lock
to ensure deterministic packages. (This is orthogonal but package non-determinism was one of the (incorrect) hypotheses for the root cause of the failure.)Err("…")
instead ofSome("")
, since""
is not a valid test key anyways.No release note as product code was not changed.