Skip to content

Commit

Permalink
Try using sub-directory of temporary dir to make GitHub runner happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mars committed Oct 23, 2024
1 parent 5123a1e commit 8289a7f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions buildpacks/release-phase/tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Required due to: https://github.com/rust-lang/rust/issues/95513
#![allow(unused_crate_dependencies)]

use std::{env, path::Path};
use std::{env, fs, path::Path};

use libcnb_test::{assert_contains, ContainerConfig};
use tempfile::tempdir;
Expand Down Expand Up @@ -72,12 +72,15 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
let maybe_github_runner_temp_dir = env::var("RUNNER_TEMP");
let temp_dir =
tempdir().expect("should create temporary directory for artifact storage");
let temp_sub_dir = "static-artifacts-storage";
let local_storage_path =
if let Ok(github_runner_temp_dir) = &maybe_github_runner_temp_dir {
Path::new(github_runner_temp_dir)
Path::new(github_runner_temp_dir).join(temp_sub_dir)
} else {
temp_dir.path()
temp_dir.path().join(temp_sub_dir)
};
fs::create_dir_all(&local_storage_path)
.expect("local_storage_path directory should be created");
let container_volume_path = "/static-artifacts-storage";
let container_volume_url = "file://".to_owned() + container_volume_path;
println!("local_storage_path: {local_storage_path:?}");
Expand All @@ -91,7 +94,7 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
ContainerConfig::new()
.env("RELEASE_ID", unique)
.env("STATIC_ARTIFACTS_URL", &container_volume_url)
.bind_mount(local_storage_path, container_volume_path),
.bind_mount(&local_storage_path, container_volume_path),
&"release".to_string(),
|container| {
let log_output = container.logs_now();
Expand All @@ -110,7 +113,7 @@ fn project_uses_release_build_and_web_process_loads_artifacts() {
ContainerConfig::new()
.env("RELEASE_ID", unique)
.env("STATIC_ARTIFACTS_URL", &container_volume_url)
.bind_mount(local_storage_path, container_volume_path),
.bind_mount(&local_storage_path, container_volume_path),
&"web".to_string(),
|container| {
let log_output = container.logs_now();
Expand Down

0 comments on commit 8289a7f

Please sign in to comment.