Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
fixed ci, ensured wadm doesn't connect to default nats
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Townsend <[email protected]>

see why fail

Signed-off-by: Brooks Townsend <[email protected]>

who made different operating systems anyways

Signed-off-by: Brooks Townsend <[email protected]>

actually handled different OS errors

Signed-off-by: Brooks Townsend <[email protected]>
  • Loading branch information
brooksmtownsend committed May 15, 2023
1 parent 1d7a4d0 commit b348399
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test: ## Run unit test suite

test-wash-ci:
@$(CARGO) nextest run --profile ci --workspace --bin wash
@$(CARGO) nextest run --profile ci -p wash-lib

test-watch: ## Run unit tests continously, can optionally specify a target test filter.
@$(CARGO) watch -- $(CARGO) nextest run $(TARGET)
Expand Down
17 changes: 15 additions & 2 deletions crates/wash-lib/src/start/wadm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,29 @@ mod test {
let log_path = install_dir.join("wadm.log");
let log_file = tokio::fs::File::create(&log_path).await?.into_std().await;

let child_res = start_wadm(&install_dir.join(WADM_BINARY), log_file, None).await;
let config = WadmConfig {
structured_logging: false,
js_domain: None,
nats_server_url: "nats://127.0.0.1:54321".to_string(),
nats_credsfile: None,
};

let child_res = start_wadm(&install_dir.join(WADM_BINARY), log_file, Some(config)).await;
assert!(child_res.is_ok());

// Wait for process to exit since NATS couldn't connect
assert!(child_res.unwrap().wait().await.is_ok());
let log_contents = tokio::fs::read_to_string(&log_path).await?;
// wadm couldn't connect to NATS but that's okay

// Different OS-es have different error codes, but all I care about is that wadm executed at all
#[cfg(target_os = "macos")]
assert!(log_contents.contains("Connection refused (os error 61)"));
#[cfg(target_os = "linux")]
assert!(log_contents.contains("Connection refused (os error 111)"));
#[cfg(target_os = "windows")]
assert!(log_contents.contains("No connection could be made because the target machine actively refused it. (os error 10061)"));

// child_res.unwrap().kill().await?;
let _ = remove_dir_all(install_dir).await;
Ok(())
}
Expand Down

0 comments on commit b348399

Please sign in to comment.