Skip to content

Commit

Permalink
fix tests that fail with incorrect config dir permissions (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl authored Oct 9, 2024
1 parent d0cd7e4 commit b5a932c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/src/cmd_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,15 @@ mod tests {
use assert_cmd::Command;
use predicates::str;

let temp_dir = tempfile::tempdir().unwrap().into_path();

let bad_url = "sys.oxide.invalid";

// Validate connection error details are printed
Command::cargo_bin("oxide")
.unwrap()
.arg("--config-dir")
.arg(temp_dir.as_os_str())
.arg("auth")
.arg("login")
.arg("--host")
Expand Down
9 changes: 9 additions & 0 deletions cli/tests/test_disk_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ fn test_disk_import_bad_file_size() {
// Test for required parameters being supplied
#[test]
fn test_disk_import_required_parameters() {
let temp_dir = tempfile::tempdir().unwrap().into_path();
let test_file = Testfile::new_random(512 + 1).unwrap();

// only supplying --image-description won't work
Expand All @@ -546,6 +547,8 @@ fn test_disk_import_required_parameters() {
.env("RUST_BACKTRACE", "1")
.env("OXIDE_HOST", "http://no.mock.server.needed")
.env("OXIDE_TOKEN", "fake-token")
.arg("--config-dir")
.arg(temp_dir.as_os_str())
.arg("disk")
.arg("import")
.arg("--project")
Expand Down Expand Up @@ -574,6 +577,8 @@ fn test_disk_import_required_parameters() {
.env("RUST_BACKTRACE", "1")
.env("OXIDE_HOST", "http://no.mock.server.needed")
.env("OXIDE_TOKEN", "fake-token")
.arg("--config-dir")
.arg(temp_dir.as_os_str())
.arg("disk")
.arg("import")
.arg("--project")
Expand All @@ -599,6 +604,8 @@ fn test_disk_import_required_parameters() {
.env("RUST_BACKTRACE", "1")
.env("OXIDE_HOST", "http://no.mock.server.needed")
.env("OXIDE_TOKEN", "fake-token")
.arg("--config-dir")
.arg(temp_dir.as_os_str())
.arg("disk")
.arg("import")
.arg("--project")
Expand Down Expand Up @@ -636,6 +643,8 @@ fn test_disk_import_required_parameters() {
.env("RUST_BACKTRACE", "1")
.env("OXIDE_HOST", "http://no.mock.server.needed")
.env("OXIDE_TOKEN", "fake-token")
.arg("--config-dir")
.arg(temp_dir.as_os_str())
.arg("disk")
.arg("import")
.arg("--project")
Expand Down

0 comments on commit b5a932c

Please sign in to comment.