-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub(crate) const JAVA_TOOL_OPTIONS_ENV_VAR_DELIMITER: &str = " "; | ||
pub(crate) const JAVA_TOOL_OPTIONS_ENV_VAR_NAME: &str = "JAVA_TOOL_OPTIONS"; | ||
pub(crate) const JDK_OVERLAY_DIR_NAME: &str = ".jdk_overlay"; | ||
pub(crate) const JDK_OVERLAY_DIR_NAME: &str = ".jdk-overlay"; | ||
pub(crate) const OPENJDK_LATEST_LTS_VERSION: u32 = 21; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::default_build_config; | ||
use libcnb_test::{assert_contains, TestRunner}; | ||
use std::path::PathBuf; | ||
|
||
#[test] | ||
#[ignore = "integration test"] | ||
fn overlay() { | ||
const ADDITIONAL_PATH: &str = "earth.txt"; | ||
const ADDITIONAL_CONTENTS: &str = "Un diminuto punto azul"; | ||
|
||
const CACERTS_PATH: &str = "lib/security/cacerts"; | ||
const CACERTS_CONTENTS: &str = "overwritten"; | ||
|
||
TestRunner::default().build( | ||
default_build_config("test-apps/java-21-app").app_dir_preprocessor(|app_dir| { | ||
let overlay_path = app_dir.join(".jdk-overlay"); | ||
std::fs::create_dir_all(&overlay_path).unwrap(); | ||
std::fs::write(overlay_path.join(ADDITIONAL_PATH), ADDITIONAL_CONTENTS).unwrap(); | ||
|
||
let cacerts_path = overlay_path.join(PathBuf::from(CACERTS_PATH)); | ||
std::fs::create_dir_all(&cacerts_path.parent().unwrap()).unwrap(); | ||
std::fs::write(&cacerts_path, CACERTS_CONTENTS).unwrap(); | ||
}), | ||
|context| { | ||
// Validate that adding a new file works | ||
assert_contains!( | ||
context | ||
.run_shell_command(format!("cat $JAVA_HOME/{ADDITIONAL_PATH}")) | ||
.stdout, | ||
ADDITIONAL_CONTENTS | ||
); | ||
|
||
// Validate that overwriting a file works | ||
assert_contains!( | ||
context | ||
.run_shell_command(format!("cat $JAVA_HOME/{CACERTS_PATH}")) | ||
.stdout, | ||
CACERTS_CONTENTS | ||
); | ||
}, | ||
); | ||
} |