diff --git a/build.sh b/build.sh index 4b8251326..94891527d 100755 --- a/build.sh +++ b/build.sh @@ -19,8 +19,6 @@ ################################################################################ set -e # Exit on error -# Truncate $BASH_COMMAND in the trap (where it correctly reflects the failing -# command) to avoid ARG_MAX limits after a failed mvn invocation. trap 'handle_error $? $LINENO "${BASH_COMMAND:0:200}"' ERR # Error handling function @@ -265,6 +263,7 @@ IT_DEBUG=false IT_DEBUG_PORT=5006 IT_DEBUG_SUSPEND=false SKIP_MIGRATION_TESTS=false +KEEP_CONTAINER=false # Enhanced usage function with color support usage() { @@ -303,7 +302,8 @@ EOF echo -e " ${CYAN}--it-debug-port PORT${NC} Set integration test debug port" echo -e " ${CYAN}--it-debug-suspend${NC} Suspend integration test until debugger connects" echo -e " ${CYAN}--skip-migration-tests${NC} Skip migration-related tests" - echo -e " ${CYAN}--ci${NC} CI mode: no Karaf, no Maven cache, Maven -B -ntp, non-interactive" + echo -e " ${CYAN}--keep-container${NC} Keep search engine container running after tests (for post-failure inspection)" + echo -e " ${CYAN}--ci${NC} CI mode: no Karaf, no Maven build cache, non-interactive" else cat << "EOF" _ _ _____ _ ____ @@ -337,7 +337,8 @@ EOF echo " --it-debug-port PORT Set integration test debug port" echo " --it-debug-suspend Suspend integration test until debugger connects" echo " --skip-migration-tests Skip migration-related tests" - echo " --ci CI mode: no Karaf, no Maven cache, Maven -B -ntp, non-interactive" + echo " --keep-container Keep search engine container running after tests (for post-failure inspection)" + echo " --ci CI mode: no Karaf, no Maven build cache, non-interactive" fi echo @@ -468,6 +469,9 @@ while [ "$1" != "" ]; do --skip-migration-tests) SKIP_MIGRATION_TESTS=true ;; + --keep-container) + KEEP_CONTAINER=true + ;; --ci) NO_KARAF=true USE_MAVEN_CACHE=false @@ -784,11 +788,6 @@ check_requirements() { MVN_CMD="mvn" MVN_OPTS="" -# CI / non-interactive: no download progress UI, batch mode (matches former workflow mvn -ntp) -if is_non_interactive; then - MVN_OPTS="$MVN_OPTS -B -ntp" -fi - # Add Maven debug option if [ "$MAVEN_DEBUG" = true ]; then MVN_OPTS="$MVN_OPTS -X" @@ -874,6 +873,12 @@ if [ "$RUN_INTEGRATION_TESTS" = true ]; then MVN_OPTS="$MVN_OPTS -Dit.test.exclude.pattern=**/migration/**/*IT.java" echo "Skipping migration tests" fi + + # Keep container running after tests if requested + if [ "$KEEP_CONTAINER" = true ]; then + MVN_OPTS="$MVN_OPTS -Dit.keepContainer=true" + echo "Search engine container will be kept running after tests" + fi else if [ "$SKIP_TESTS" = true ]; then PROFILES="$PROFILES,!integration-tests,!run-tests" @@ -932,7 +937,6 @@ if [ "$HAS_COLORS" -eq 1 ]; then else echo "Running: $MVN_CMD clean $MVN_OPTS" fi -# shellcheck disable=SC2086 $MVN_CMD clean $MVN_OPTS || { print_status "error" "Maven clean failed" exit 1 @@ -944,7 +948,6 @@ if [ "$HAS_COLORS" -eq 1 ]; then else echo "Running: $MVN_CMD install $MVN_OPTS" fi -# shellcheck disable=SC2086 $MVN_CMD install $MVN_OPTS || { print_status "error" "Maven install failed" exit 1 diff --git a/itests/pom.xml b/itests/pom.xml index 98e98e9e5..239ef3015 100644 --- a/itests/pom.xml +++ b/itests/pom.xml @@ -32,6 +32,8 @@ elasticsearch false itests-opensearch + + false @@ -196,6 +198,14 @@ + + + + + + @@ -210,6 +220,10 @@ elasticsearch + + 9400 + 4g + true @@ -229,6 +243,7 @@ foo elasticsearch + ${elasticsearch.port} @@ -247,47 +262,74 @@ - com.github.alexcojocaru - elasticsearch-maven-plugin - - 6.29 + io.fabric8 + docker-maven-plugin - - contextElasticSearchITests - 9500 - 9400 - ${elasticsearch.test.version} - true - 120 - - -Xms4g -Xmx4g - - - - false - ${project.build.directory}/snapshots_repository - false - OPTIONS,HEAD,GET,POST,PUT,DELETE - Authorization,X-Requested-With,X-Auth-Token,Content-Type,Content-Length - - + itests-elasticsearch + + + docker.elastic.co/elasticsearch/elasticsearch:${elasticsearch.test.version} + elasticsearch + + + ${elasticsearch.port}:9200 + + + single-node + -Xms${elasticsearch.heap} -Xmx${elasticsearch.heap} + false + false + /tmp/snapshots_repository + false + + + + ${project.build.directory}/snapshots_repository:/tmp/snapshots_repository + + + + + http://localhost:${elasticsearch.port} + GET + 200 + + + + ${project.build.directory}/elasticsearch-port.properties + + + - + + + remove-existing-container + pre-integration-test + + true + + + stop + remove + + + start-elasticsearch pre-integration-test - runforked + start + + true + stop-elasticsearch post-integration-test + + ${it.keepContainer} + stop @@ -354,7 +396,7 @@ single-node - -Xms4g -Xmx4g -Dcluster.default.index.settings.number_of_replicas=0 + -Xms4g -Xmx4g /tmp/snapshots_repository true Unomi.1ntegrat10n.Tests @@ -378,13 +420,16 @@ - + remove-existing-container pre-integration-test + + true + - stop - remove + stop + remove @@ -398,6 +443,16 @@ true + + stop-opensearch + post-integration-test + + ${it.keepContainer} + + + stop + + diff --git a/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java b/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java index 1bc731e42..66f1de7fc 100644 --- a/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java +++ b/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java @@ -93,10 +93,7 @@ public void testUpdateProperties_CurrentProfile() { updateProperties.setProperty(UpdatePropertiesAction.TARGET_TYPE_KEY, "profile"); int changes = eventService.send(updateProperties); - - LOGGER.info("Changes of the event : {}", changes); - - Assert.assertTrue(changes > 0); + Assert.assertTrue("eventService.send() reported no changes — action may not have fired", changes > 0); // Current profile on the event is updated in memory; do not poll persistence here. Assert.assertEquals("UPDATED FIRST NAME CURRENT PROFILE", profile.getProperty("firstName")); } diff --git a/pom.xml b/pom.xml index 174e68308..f7e85f403 100644 --- a/pom.xml +++ b/pom.xml @@ -146,6 +146,7 @@ 3.21.0 0.16.1 1.0-m5.1 + 0.48.0 v16.20.2 v1.22.19 @@ -867,6 +868,11 @@ dependency-check-maven ${dependency-check.plugin.version} + + io.fabric8 + docker-maven-plugin + ${docker-maven-plugin.version} +