Skip to content

Commit

Permalink
Prefer temp dir for integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
runesoerensen committed Oct 21, 2024
1 parent 71763fc commit 3f63f46
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ packaged/
*.cnb

.DS_Store

.integration-test-static-artifacts-storage/
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions buildpacks/release-phase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ toml = { version = "0.8", features = ["preserve_order"] }

[dev-dependencies]
libcnb-test = { git = "https://github.com/mars/libcnb.rs.git", branch = "docker-volume" }
tempfile = "3"
test_support.workspace = true
uuid = { version = "1.10.0", features = ["v4", "serde"] }
2 changes: 2 additions & 0 deletions buildpacks/release-phase/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use setup_release_phase::setup_release_phase;
#[cfg(test)]
use libcnb_test as _;
#[cfg(test)]
use tempfile as _;
#[cfg(test)]
use test_support as _;
#[cfg(test)]
use uuid as _;
Expand Down
9 changes: 3 additions & 6 deletions buildpacks/release-phase/tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Required due to: https://github.com/rust-lang/rust/issues/95513
#![allow(unused_crate_dependencies)]

use std::fs::{self, create_dir};

use libcnb_test::{assert_contains, ContainerConfig};
use tempfile::tempdir;
use test_support::{
release_phase_and_procfile_integration_test, release_phase_integration_test,
start_container_entrypoint,
Expand Down Expand Up @@ -68,8 +67,8 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
"./fixtures/project_uses_release_build_with_web_process",
|ctx| {
let unique = Uuid::new_v4();
let local_storage_path = "./.integration-test-static-artifacts-storage";
create_dir(local_storage_path).unwrap();
let local_storage_tmp_dir = tempdir().unwrap();
let local_storage_path = local_storage_tmp_dir.path().to_str().unwrap();
let container_volume_path = "/workspace/static-artifacts-storage";
let container_volume_url = "file://".to_owned() + container_volume_path;
let volume = local_storage_path.to_owned() + ":" + container_volume_path;
Expand Down Expand Up @@ -113,8 +112,6 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
assert_contains!(log_output.stdout, "Hello static world!");
},
);
fs::remove_file(format!("{local_storage_path}/release-{unique}.tgz"))
.expect("the generated test archive can be deleted");
},
);
}
Expand Down

0 comments on commit 3f63f46

Please sign in to comment.