From d34f43c0eecf74c96da58bca9fb034f1e9c8aa62 Mon Sep 17 00:00:00 2001 From: Schneems Date: Fri, 31 Jan 2025 16:45:17 -0600 Subject: [PATCH] Update tests --- .../maven/tests/integration/customization.rs | 2 +- buildpacks/maven/tests/integration/misc.rs | 15 +++++----- .../maven/tests/integration/settings_xml.rs | 29 +++++++++++-------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/buildpacks/maven/tests/integration/customization.rs b/buildpacks/maven/tests/integration/customization.rs index 594ecc58..7e7c66bf 100644 --- a/buildpacks/maven/tests/integration/customization.rs +++ b/buildpacks/maven/tests/integration/customization.rs @@ -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 diff --git a/buildpacks/maven/tests/integration/misc.rs b/buildpacks/maven/tests/integration/misc.rs index 52444c29..45bc2136 100644 --- a/buildpacks/maven/tests/integration/misc.rs +++ b/buildpacks/maven/tests/integration/misc.rs @@ -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'." ); - }); + }, + ); } diff --git a/buildpacks/maven/tests/integration/settings_xml.rs b/buildpacks/maven/tests/integration/settings_xml.rs index c1cc866f..55d9e42f 100644 --- a/buildpacks/maven/tests/integration/settings_xml.rs +++ b/buildpacks/maven/tests/integration/settings_xml.rs @@ -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]