Skip to content

Commit

Permalink
Merge torrust#875: Fix and improved bootstrap jobs module test.
Browse files Browse the repository at this point in the history
9be9366 Fix and improved bootstrap jobs module test. (Gabriel GRONDIN)

Pull request description:

  On non-English operating systems, the source ``BadTlsConfig`` error message will be different from the compared message.
  This solves the problem by matching the enumeration itself, rather than relying on a string comparison.

ACKs for top commit:
  josecelano:
    ACK 9be9366

Tree-SHA512: c79ec1953e929ba9b2efe5c429645b34fd35a42f99924e78fd45ac9204dafaa96a1ac3097ac28014c808517eb2af67e16da64cba93974268c1735d1ad0de8baa
  • Loading branch information
josecelano committed May 20, 2024
2 parents 5478c3d + 9be9366 commit d4eaea9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/bootstrap/jobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mod tests {
use camino::Utf8PathBuf;
use torrust_tracker_configuration::TslConfig;

use super::make_rust_tls;
use super::{make_rust_tls, Error};

#[tokio::test]
async fn it_should_error_on_bad_tls_config() {
Expand All @@ -65,9 +65,7 @@ mod tests {
.expect("tls_was_enabled")
.expect_err("bad_cert_and_key_files");

assert!(err
.to_string()
.contains("bad tls config: No such file or directory (os error 2)"));
assert!(matches!(err, Error::BadTlsConfig { source: _ }));
}

#[tokio::test]
Expand All @@ -83,7 +81,7 @@ mod tests {
.expect("tls_was_enabled")
.expect_err("missing_config");

assert_eq!(err.to_string(), "tls config missing");
assert!(matches!(err, Error::MissingTlsConfig { location: _ }));
}
}

Expand Down

0 comments on commit d4eaea9

Please sign in to comment.