Skip to content

Commit d4eaea9

Browse files
committed
Merge torrust#875: Fix and improved bootstrap jobs module test.
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
2 parents 5478c3d + 9be9366 commit d4eaea9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/bootstrap/jobs/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod tests {
5050
use camino::Utf8PathBuf;
5151
use torrust_tracker_configuration::TslConfig;
5252

53-
use super::make_rust_tls;
53+
use super::{make_rust_tls, Error};
5454

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

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

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

86-
assert_eq!(err.to_string(), "tls config missing");
84+
assert!(matches!(err, Error::MissingTlsConfig { location: _ }));
8785
}
8886
}
8987

0 commit comments

Comments
 (0)