Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Jan 31, 2025
1 parent 824955c commit d34f43c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion buildpacks/maven/tests/integration/customization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use libcnb_test::{assert_contains, TestRunner};
fn maven_custom_goals() {
TestRunner::default().build(default_build_config("test-apps/simple-http-service").env("MAVEN_CUSTOM_GOALS", "site"), |context| {
// Assert only the goals in MAVEN_CUSTOM_GOALS are executed
assert_contains!(context.pack_stdout, "./mvnw -DskipTests site");
assert_contains!(context.pack_stdout, "Running `./mvnw -DskipTests -B site`");
assert_contains!(context.pack_stdout,"[INFO] --- maven-site-plugin:3.7.1:site (default-site) @ simple-http-service ---");

// The dependency list is implemented by using the dependency:list goal. We need to
Expand Down
15 changes: 8 additions & 7 deletions buildpacks/maven/tests/integration/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,18 @@ fn no_internal_maven_options_logging() {
#[test]
#[ignore = "integration test"]
fn descriptive_error_message_on_failed_build() {
TestRunner::default().build(default_build_config("test-apps/app-with-compile-error").expected_pack_result(PackResult::Failure), |context| {
TestRunner::default().build(
default_build_config("test-apps/app-with-compile-error")
.expected_pack_result(PackResult::Failure),
|context| {
assert_contains!(context.pack_stdout, "[INFO] BUILD FAILURE");

assert_contains!(
context.pack_stderr,
"! ERROR: Unexpected Maven exit code"
);
assert_contains!(context.pack_stderr, "! ERROR: Unexpected Maven exit code");

assert_contains!(
context.pack_stderr,
"Maven unexpectedly exited with code '1'. The most common reason for this are\nproblems with your application code and/or build configuration."
"Maven unexpectedly exited with code '1'."
);
});
},
);
}
29 changes: 17 additions & 12 deletions buildpacks/maven/tests/integration/settings_xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@ fn maven_settings_url_success() {
fn maven_settings_url_failure() {
TestRunner::default().build(
default_build_config("test-apps/simple-http-service")
.env("MAVEN_SETTINGS_URL", SETTINGS_XML_URL_404)
.expected_pack_result(PackResult::Failure),
|context| {
assert_contains!(
context.pack_stderr,
&format!("You have set MAVEN_SETTINGS_URL to \"{SETTINGS_XML_URL_404}\". We tried to download the file at this\nURL, but the download failed. Please verify that the given URL is correct and try again.")
);

// This error message comes from Maven itself. We don't expect Maven to to be executed at all.
assert_not_contains!(context.pack_stdout, "[INFO] BUILD FAILURE");
},
);
.env("MAVEN_SETTINGS_URL", SETTINGS_XML_URL_404)
.expected_pack_result(PackResult::Failure),
|context| {
assert_contains!(
context.pack_stderr,
&format!("You have set MAVEN_SETTINGS_URL to \"{SETTINGS_XML_URL_404}\".")
);

assert_contains!(
context.pack_stderr,
"Please verify that the given URL is correct and try again."
);

// This error message comes from Maven itself. We don't expect Maven to to be executed at all.
assert_not_contains!(context.pack_stdout, "[INFO] BUILD FAILURE");
},
);
}

#[test]
Expand Down

0 comments on commit d34f43c

Please sign in to comment.