diff --git a/s2i/kogito-data-index-overrides.yaml b/s2i/kogito-data-index-overrides.yaml index 9ea48d20f..a3bfe932f 100644 --- a/s2i/kogito-data-index-overrides.yaml +++ b/s2i/kogito-data-index-overrides.yaml @@ -13,23 +13,6 @@ labels: - name: "io.openshift.expose-services" value: "8080:http" -envs: -- name: "INFINISPAN_USEAUTH" - value: "false" - description: "Flag that signals to Infinispan Hotrod client to use authentication (Used to set the infinispan.client.hotrod.use_auth system property)" -- name: "INFINISPAN_USERNAME" - value: "" - description: "Username for the user credential used by the Hotrod client (Used to set the infinispan.client.hotrod.auth_username system property)" -- name: "INFINISPAN_PASSWORD" - value: "" - description: "Password for the user credential used by the Hotrod client (Used to set the infinispan.client.hotrod.auth_password system property)" -- name: "INFINISPAN_AUTHREALM" - value: "" - description: "Infinispan authentication realm (Used to set the infinispan.client.hotrod.auth_realm system property)" -- name: "INFINISPAN_SASLMECHANISM" - value: "" - description: "Sasl mechanism to use during authentication. Example: PLAIN (Used to set the infinispan.client.hotrod.sasl_mechanism system property)" - ports: - value: 8080 @@ -37,13 +20,15 @@ modules: install: - name: org.kie.kogito.image.dependencies - name: org.kie.kogito.system.user + - name: org.kie.kogito.openjdk + version: "1.8.0-headless" + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.infinispan.properties - name: org.kie.kogito.dataindex -packages: - install: - - java-1.8.0-openjdk - run: + workdir: "/home/kogito/" user: 1001 - cmd: - - "/home/kogito/bin/start" + cmd: + - "/home/kogito/kogito-app-launch.sh" + diff --git a/s2i/modules/kogito-data-index/added/kogito-app-launch.sh b/s2i/modules/kogito-data-index/added/kogito-app-launch.sh new file mode 100644 index 000000000..1abcbb584 --- /dev/null +++ b/s2i/modules/kogito-data-index/added/kogito-app-launch.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + echo "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + echo "JVM settings debug is enabled." +fi + + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + ${KOGITO_HOME}/launch/kogito-infinispan-properties.sh +) +source ${KOGITO_HOME}/launch/configure.sh +############################################# + +exec java ${SHOW_JVM_SETTINGS} ${JAVA_OPTIONS} ${INFINISPAN_PROPERTIES}-Djava.library.path=$KOGITO_HOME/lib \ + -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 \ + -jar $KOGITO_HOME/bin/kogito-data-index-runner.jar \ No newline at end of file diff --git a/s2i/modules/kogito-data-index/added/start b/s2i/modules/kogito-data-index/added/start deleted file mode 100755 index 148ed736a..000000000 --- a/s2i/modules/kogito-data-index/added/start +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -e - -# see https://quarkus.io/guides/infinispan-client-guide#quarkus-infinispan-client_configuration -function set_infinispan_props() { - local infinispan_props="" - - if [[ "${INFINISPAN_USEAUTH}" == "true" ]] && [[ -z "${INFINISPAN_USERNAME}" || -z "${INFINISPAN_PASSWORD}" ]]; then - echo "[ERROR] Flag INFINISPAN_USEAUTH set to true, but no username or password informed. Please use INFINISPAN_USERNAME and INFINISPAN_PASSWORD variables to set the right credentials." - exit 1 - fi - - if [ -z "${INFINISPAN_USERNAME}" ]; then - if [ ! -z "${INFINISPAN_USEAUTH}" ]; then - INFINISPAN_USEAUTH="false" - fi - fi - - if [ ! -z "${INFINISPAN_USERNAME}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.auth-username=${INFINISPAN_USERNAME}"); INFINISPAN_USEAUTH="true"; fi - if [ ! -z "${INFINISPAN_PASSWORD}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.auth-password=${INFINISPAN_PASSWORD}"); fi - if [ ! -z "${INFINISPAN_USEAUTH}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.use-auth=${INFINISPAN_USEAUTH}"); fi - if [ ! -z "${INFINISPAN_AUTHREALM}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.auth-realm=${INFINISPAN_AUTHREALM}"); fi - if [ ! -z "${INFINISPAN_SASLMECHANISM}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.sasl-mechanism=${INFINISPAN_SASLMECHANISM}"); fi - - echo $infinispan_props -} - -function start() { - - if [ "${SCRIPT_DEBUG}" = "true" ] ; then - set -x - SHOW_JVM_SETTINGS="-XshowSettings:properties" - echo "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" - echo "JVM settings debug is enabled." - fi - - - local infinispan_props=$(set_infinispan_props) - - java ${SHOW_JVM_SETTINGS} -Djava.library.path=$KOGITO_HOME/lib \ - -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 \ - ${infinispan_props} \ - ${JAVA_OPTS} \ - -jar $KOGITO_HOME/bin/*-runner.jar -} - -if [ -z "${TEST}" ]; then - start -fi \ No newline at end of file diff --git a/s2i/modules/kogito-data-index/configure b/s2i/modules/kogito-data-index/configure index a34371eeb..f1a791103 100644 --- a/s2i/modules/kogito-data-index/configure +++ b/s2i/modules/kogito-data-index/configure @@ -5,8 +5,12 @@ SOURCES_DIR=/tmp/artifacts SCRIPT_DIR=$(dirname $0) ADDED_DIR=${SCRIPT_DIR}/added -mv ${SOURCES_DIR}/data-index-service-*-runner.jar ${KOGITO_HOME}/bin/ -mv ${ADDED_DIR}/* ${KOGITO_HOME}/bin/ +cp -v ${SOURCES_DIR}/kogito-data-index-runner.jar ${KOGITO_HOME}/bin/ chown -R 1001:0 ${KOGITO_HOME} chmod -R ug+rwX ${KOGITO_HOME} + + +cp -v ${ADDED_DIR}/kogito-app-launch.sh ${KOGITO_HOME} +chmod +x-w ${KOGITO_HOME}/kogito-app-launch.sh + diff --git a/s2i/modules/kogito-data-index/module.yaml b/s2i/modules/kogito-data-index/module.yaml index dda46f055..2ea815840 100644 --- a/s2i/modules/kogito-data-index/module.yaml +++ b/s2i/modules/kogito-data-index/module.yaml @@ -3,7 +3,7 @@ name: org.kie.kogito.dataindex version: "0.7.0-rc1" artifacts: -- name: data-index-service-8.0.0-SNAPSHOT-runner.jar +- name: kogito-data-index-runner.jar url: https://repository.jboss.org/org/kie/kogito/data-index-service/8.0.0-SNAPSHOT/data-index-service-8.0.0-20191216.211654-103-runner.jar md5: aa73da330737993d08daf8046bffe728 diff --git a/s2i/modules/kogito-data-index/tests/bats/kogito-data-index.bats b/s2i/modules/kogito-data-index/tests/bats/kogito-data-index.bats new file mode 100644 index 000000000..27de61c08 --- /dev/null +++ b/s2i/modules/kogito-data-index/tests/bats/kogito-data-index.bats @@ -0,0 +1,101 @@ +#!/usr/bin/env bats + +export KOGITO_HOME=/tmp/kogito +export HOME=$KOGITO_HOME +mkdir -p ${KOGITO_HOME}/launch +cp $BATS_TEST_DIRNAME/../../../kogito-infinispan-properties/added/kogito-infinispan-properties.sh ${KOGITO_HOME}/launch/ + +load ${KOGITO_HOME}/launch/kogito-infinispan-properties.sh + +teardown() { + rm -rf ${KOGITO_HOME} +} + +function clear_vars() { + unset INFINISPAN_USEAUTH + unset INFINISPAN_USERNAME + unset INFINISPAN_PASSWORD + unset INFINISPAN_AUTHREALM + unset INFINISPAN_SASLMECHANISM +} + +@test "check if infinispan properties is blank" { + clear_vars + local expected="" + configure_infinispan_props + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] +} + + +@test "check if infinispan auth is false" { + clear_vars + export INFINISPAN_USEAUTH="false" + local expected=" -Dquarkus.infinispan-client.use-auth=false" + configure_infinispan_props + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] +} + +@test "check if infinispan has auth props" { + clear_vars + export INFINISPAN_USERNAME="developer" + export INFINISPAN_USEAUTH="true" + export INFINISPAN_PASSWORD="developer" + export INFINISPAN_AUTHREALM="default" + export INFINISPAN_SASLMECHANISM="PLAIN" + + local expected=" -Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.auth-password=developer -Dquarkus.infinispan-client.use-auth=true -Dquarkus.infinispan-client.auth-realm=default -Dquarkus.infinispan-client.sasl-mechanism=PLAIN" + configure_infinispan_props + + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] +} + +@test "setting username, useauth is true" { + clear_vars + export INFINISPAN_USERNAME="developer" + export INFINISPAN_USEAUTH="false" + local expected=" -Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" + + configure_infinispan_props + + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] +} + +@test "when use auth is set to nonsense and no credentials" { + clear_vars + export INFINISPAN_USEAUTH="dsadsadasdsa" + local expected=" -Dquarkus.infinispan-client.use-auth=false" + + configure_infinispan_props + + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] +} + +@test "when use auth is set to nonsense and has credentials" { + clear_vars + export INFINISPAN_USEAUTH="dsadsadasdsa" + export INFINISPAN_USERNAME="developer" + local expected=" -Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" + + configure_infinispan_props + + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] +} + +@test "when use auth is set to true and no credentials" { + clear_vars + export INFINISPAN_USEAUTH="true" + + run configure_infinispan_props + + expected="[ERROR] Flag INFINISPAN_USEAUTH set to true, but no username or password informed. Please use INFINISPAN_USERNAME and INFINISPAN_PASSWORD variables to set the right credentials." + echo "Result is ${output} and expected is ${expected}" + echo "Expected status is 1, outcome status is ${status}" + [ "$status" -eq 1 ] + [ "${output}" = "${expected}" ] +} \ No newline at end of file diff --git a/s2i/modules/kogito-data-index/tests/bats/kogito-dataindex-start.bats b/s2i/modules/kogito-data-index/tests/bats/kogito-dataindex-start.bats deleted file mode 100644 index 6e7d85c0e..000000000 --- a/s2i/modules/kogito-data-index/tests/bats/kogito-dataindex-start.bats +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env bats - -export TEST=true - -# import -load $BATS_TEST_DIRNAME/../../added/start - -function clear_vars() { - unset INFINISPAN_USEAUTH - unset INFINISPAN_USERNAME - unset INFINISPAN_PASSWORD - unset INFINISPAN_AUTHREALM - unset INFINISPAN_SASLMECHANISM -} - -@test "check if infinispan properties is blank" { - clear_vars - local expected="" - run set_infinispan_props - - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] -} - - -@test "check if infinispan auth is false" { - clear_vars - export INFINISPAN_USEAUTH="false" - local expected="-Dquarkus.infinispan-client.use-auth=false" - run set_infinispan_props - - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] -} - -@test "check if infinispan has auth props" { - clear_vars - export INFINISPAN_USERNAME="developer" - export INFINISPAN_USEAUTH="true" - export INFINISPAN_PASSWORD="developer" - export INFINISPAN_AUTHREALM="default" - export INFINISPAN_SASLMECHANISM="PLAIN" - - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.auth-password=developer -Dquarkus.infinispan-client.use-auth=true -Dquarkus.infinispan-client.auth-realm=default -Dquarkus.infinispan-client.sasl-mechanism=PLAIN" - run set_infinispan_props - - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] -} - -@test "setting username, useauth is true" { - clear_vars - export INFINISPAN_USERNAME="developer" - export INFINISPAN_USEAUTH="false" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" - - run set_infinispan_props - - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] -} - -@test "when use auth is set to nonsense and no credentials" { - clear_vars - export INFINISPAN_USEAUTH="dsadsadasdsa" - local expected="-Dquarkus.infinispan-client.use-auth=false" - - run set_infinispan_props - - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] -} - -@test "when use auth is set to nonsense and has credentials" { - clear_vars - export INFINISPAN_USEAUTH="dsadsadasdsa" - export INFINISPAN_USERNAME="developer" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" - - run set_infinispan_props - - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] -} - -@test "when use auth is set to true and no credentials" { - clear_vars - export INFINISPAN_USEAUTH="true" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" - - run set_infinispan_props - # exit(1) - [ "$status" -eq 1 ] -} \ No newline at end of file diff --git a/s2i/modules/kogito-infinispan-properties/added/kogito-infinispan-properties.sh b/s2i/modules/kogito-infinispan-properties/added/kogito-infinispan-properties.sh index 377faf0c2..d1b564c64 100755 --- a/s2i/modules/kogito-infinispan-properties/added/kogito-infinispan-properties.sh +++ b/s2i/modules/kogito-infinispan-properties/added/kogito-infinispan-properties.sh @@ -1,7 +1,21 @@ #!/bin/bash -e +function prepareEnv() { + # keep it on alphabetical order + unset INFINISPAN_AUTHREALM + unset INFINISPAN_PASSWORD + unset INFINISPAN_SASLMECHANISM + unset INFINISPAN_USEAUTH + unset INFINISPAN_USERNAME +} + +function configure() { + configure_infinispan_props +} + + # see https://quarkus.io/guides/infinispan-client-guide#quarkus-infinispan-client_configuration -function set_infinispan_props() { +function configure_infinispan_props() { local infinispan_props="" if [[ "${INFINISPAN_USEAUTH}" == "true" ]] && [[ -z "${INFINISPAN_USERNAME}" || -z "${INFINISPAN_PASSWORD}" ]]; then @@ -21,6 +35,6 @@ function set_infinispan_props() { if [ ! -z "${INFINISPAN_AUTHREALM}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.auth-realm=${INFINISPAN_AUTHREALM}"); fi if [ ! -z "${INFINISPAN_SASLMECHANISM}" ]; then infinispan_props=$(echo "${infinispan_props} -Dquarkus.infinispan-client.sasl-mechanism=${INFINISPAN_SASLMECHANISM}"); fi - echo $infinispan_props + INFINISPAN_PROPERTIES="${infinispan_props}" } diff --git a/s2i/modules/kogito-infinispan-properties/tests/bats/kogito-infinispan-properties.bats b/s2i/modules/kogito-infinispan-properties/tests/bats/kogito-infinispan-properties.bats index 92bd33293..9502c089e 100644 --- a/s2i/modules/kogito-infinispan-properties/tests/bats/kogito-infinispan-properties.bats +++ b/s2i/modules/kogito-infinispan-properties/tests/bats/kogito-infinispan-properties.bats @@ -16,21 +16,21 @@ function clear_vars() { @test "check if infinispan properties is blank" { clear_vars local expected="" - run set_infinispan_props + configure_infinispan_props - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] } @test "check if infinispan auth is false" { clear_vars export INFINISPAN_USEAUTH="false" - local expected="-Dquarkus.infinispan-client.use-auth=false" - run set_infinispan_props + local expected=" -Dquarkus.infinispan-client.use-auth=false" + configure_infinispan_props - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] } @test "check if infinispan has auth props" { @@ -41,54 +41,53 @@ function clear_vars() { export INFINISPAN_AUTHREALM="default" export INFINISPAN_SASLMECHANISM="PLAIN" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.auth-password=developer -Dquarkus.infinispan-client.use-auth=true -Dquarkus.infinispan-client.auth-realm=default -Dquarkus.infinispan-client.sasl-mechanism=PLAIN" - run set_infinispan_props + local expected=" -Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.auth-password=developer -Dquarkus.infinispan-client.use-auth=true -Dquarkus.infinispan-client.auth-realm=default -Dquarkus.infinispan-client.sasl-mechanism=PLAIN" + configure_infinispan_props - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] } @test "setting username, useauth is true" { clear_vars export INFINISPAN_USERNAME="developer" export INFINISPAN_USEAUTH="false" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" + local expected=" -Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" - run set_infinispan_props + configure_infinispan_props - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] } @test "when use auth is set to nonsense and no credentials" { clear_vars export INFINISPAN_USEAUTH="dsadsadasdsa" - local expected="-Dquarkus.infinispan-client.use-auth=false" + local expected=" -Dquarkus.infinispan-client.use-auth=false" - run set_infinispan_props + configure_infinispan_props - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] } @test "when use auth is set to nonsense and has credentials" { clear_vars export INFINISPAN_USEAUTH="dsadsadasdsa" export INFINISPAN_USERNAME="developer" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" + local expected=" -Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" - run set_infinispan_props + configure_infinispan_props - echo "Result is ${output} and expected is ${expected}" >&2 - [ "${expected}" = "${output}" ] + echo "Result is ${INFINISPAN_PROPERTIES} and expected is ${expected}" >&2 + [ "${expected}" = "${INFINISPAN_PROPERTIES}" ] } @test "when use auth is set to true and no credentials" { clear_vars export INFINISPAN_USEAUTH="true" - local expected="-Dquarkus.infinispan-client.auth-username=developer -Dquarkus.infinispan-client.use-auth=true" - - run set_infinispan_props - # exit(1) + run configure_infinispan_props + # exit + echo "Status: ${status}" [ "$status" -eq 1 ] } \ No newline at end of file diff --git a/s2i/modules/kogito-jobs-service/added/kogito-app-launch.sh b/s2i/modules/kogito-jobs-service/added/kogito-app-launch.sh index df122aaf2..95ea69890 100644 --- a/s2i/modules/kogito-jobs-service/added/kogito-app-launch.sh +++ b/s2i/modules/kogito-jobs-service/added/kogito-app-launch.sh @@ -8,14 +8,15 @@ if [ "${SCRIPT_DEBUG}" = "true" ] ; then fi - # Configuration scripts # Any configuration script that needs to run on image startup must be added here. CONFIGURE_SCRIPTS=( + ${KOGITO_HOME}/launch/kogito-infinispan-properties.sh ${KOGITO_HOME}/launch/kogito-jobs-service.sh ) source ${KOGITO_HOME}/launch/configure.sh ############################################# -exec java ${SHOW_JVM_SETTINGS} ${JAVA_OPTIONS} ${KOGITO_JOBS_PROPS} -jar $KOGITO_HOME/bin/kogito-jobs-service-runner.jar +exec java ${SHOW_JVM_SETTINGS} ${JAVA_OPTIONS} ${KOGITO_JOBS_PROPS} ${INFINISPAN_PROPERTIES} \ + -jar $KOGITO_HOME/bin/kogito-jobs-service-runner.jar diff --git a/s2i/modules/kogito-jobs-service/added/launch/kogito-jobs-service.sh b/s2i/modules/kogito-jobs-service/added/launch/kogito-jobs-service.sh index ef80022f6..4097c98ab 100644 --- a/s2i/modules/kogito-jobs-service/added/launch/kogito-jobs-service.sh +++ b/s2i/modules/kogito-jobs-service/added/launch/kogito-jobs-service.sh @@ -1,9 +1,5 @@ #!/usr/bin/env bash -# keep it here for now -# TODO refactor data-index image to reuse it. -source ${KOGITO_HOME}/launch/kogito-infinispan-properties.sh - function prepareEnv() { # keep it on alphabetical order unset BACKOFF_RETRY @@ -24,8 +20,7 @@ function configure_jobs_service() { echo "INFINISPAN_CLIENT_SERVER_LIST env not found, please set it." exit 1 else - infinispanProps=$(set_infinispan_props) - KOGITO_JOBS_PROPS="${KOGITO_JOBS_PROPS} -Dkogito.jobs-service.persistence=infinispan ${infinispanProps}" + KOGITO_JOBS_PROPS="${KOGITO_JOBS_PROPS} -Dkogito.jobs-service.persistence=infinispan" KOGITO_JOBS_PROPS="${KOGITO_JOBS_PROPS} -Dquarkus.infinispan-client.server-list=${INFINISPAN_CLIENT_SERVER_LIST}" fi fi diff --git a/s2i/modules/kogito-jobs-service/configure b/s2i/modules/kogito-jobs-service/configure index dbeef3afd..5745ad982 100644 --- a/s2i/modules/kogito-jobs-service/configure +++ b/s2i/modules/kogito-jobs-service/configure @@ -8,7 +8,6 @@ ADDED_DIR=${SCRIPT_DIR}/added cp -v ${SOURCES_DIR}/kogito-jobs-service-runner.jar ${KOGITO_HOME}/bin/ cp -rv ${ADDED_DIR}/launch/* ${KOGITO_HOME}/launch/ - chown -R 1001:0 ${KOGITO_HOME} chmod -R ug+rwX ${KOGITO_HOME} diff --git a/s2i/modules/kogito-jobs-service/tests/bats/kogito-jobs-service.bats b/s2i/modules/kogito-jobs-service/tests/bats/kogito-jobs-service.bats index 463d11b8f..1490c7f2e 100644 --- a/s2i/modules/kogito-jobs-service/tests/bats/kogito-jobs-service.bats +++ b/s2i/modules/kogito-jobs-service/tests/bats/kogito-jobs-service.bats @@ -8,6 +8,7 @@ cp $BATS_TEST_DIRNAME/../../../kogito-infinispan-properties/added/kogito-infinis # imports load $BATS_TEST_DIRNAME/../../added/launch/kogito-jobs-service.sh +load ${KOGITO_HOME}/launch/kogito-infinispan-properties.sh teardown() { @@ -60,9 +61,13 @@ teardown() { export INFINISPAN_USERNAME="nevermind" export INFINISPAN_PASSWORD="impossible2gues" configure_jobs_service - expected=" -Dkogito.jobs-service.persistence=infinispan -Dquarkus.infinispan-client.auth-username=nevermind -Dquarkus.infinispan-client.auth-password=impossible2gues -Dquarkus.infinispan-client.use-auth=true -Dquarkus.infinispan-client.server-list=localhost:11222" - echo "Result is ${KOGITO_JOBS_PROPS} and expected is ${expected}" - [ "${KOGITO_JOBS_PROPS}" = "${expected}" ] + configure_infinispan_props + + result="${KOGITO_JOBS_PROPS} ${INFINISPAN_PROPERTIES}" + expected=" -Dkogito.jobs-service.persistence=infinispan -Dquarkus.infinispan-client.server-list=localhost:11222 -Dquarkus.infinispan-client.auth-username=nevermind -Dquarkus.infinispan-client.auth-password=impossible2gues -Dquarkus.infinispan-client.use-auth=true" + + echo "Result is ${result} and expected is ${expected}" + [ "${result}" = "${expected}" ] } diff --git a/s2i/tests/features/kogito-data-index.feature b/s2i/tests/features/kogito-data-index.feature index 17ca527e5..cc0273609 100644 --- a/s2i/tests/features/kogito-data-index.feature +++ b/s2i/tests/features/kogito-data-index.feature @@ -14,7 +14,13 @@ Feature: Kogito-data-index feature. Scenario: verify if the binary index is available on /home/kogito When container is started with command bash - Then run sh -c 'ls /home/kogito/bin/data-index-service-*-runner.jar' in container and immediately check its output for /home/kogito/bin/data-index-service-8.0.0-SNAPSHOT-runner.jar + Then run sh -c 'ls /home/kogito/bin/kogito-data-index-runner.jar' in container and immediately check its output for /home/kogito/bin/kogito-data-index-runner.jar + + Scenario: Verify if the debug is correctly enabled + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain + exec java -XshowSettings:properties -Dquarkus.infinispan-client.use-auth=false-Djava.library.path=/home/kogito/lib -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/kogito-data-index-runner.jar Scenario: Verify data-index default configuration When container is started with env @@ -48,15 +54,11 @@ Feature: Kogito-data-index feature. And container log should contain quarkus.infinispan-client.auth-realm = SecretRealm And container log should contain quarkus.infinispan-client.sasl-mechanism = COOLGSSAPI - Scenario: verify if all parameters are correctly set + Scenario: verify if image is started When container is started with env - | variable | value | - | INFINISPAN_CREDENTIAL_SECRET | infinispan-credentials | - | INFINISPAN_AUTHREALM | default | - | INFINISPAN_USEAUTH | true | - | INFINISPAN_SASLMECHANISM | PLAIN | - | QUARKUS_INFINISPAN_CLIENT_SERVER_LIST | server:11222 | - | MP_MESSAGING_INCOMING_KOGITO_PROCESSINSTANCES_EVENTS_BOOTSTRAP_SERVERS | mycluster:9092 | - | KOGITO_PROTOBUF_FOLDER | /home/kogito | - | KOGITO_PROTOBUF_WATCH | true | - Then container log should contain Error: Could not find or load main class [ERROR] + | variable | value | + | INFINISPAN_CREDENTIAL_SECRET | infinispan-credentials | + | INFINISPAN_AUTHREALM | default | + | INFINISPAN_USEAUTH | true | + | INFINISPAN_SASLMECHANISM | PLAIN | + Then container log should not contain Error: Could not find or load main class [ERROR] diff --git a/s2i/tests/features/kogito-jobs-service.feature b/s2i/tests/features/kogito-jobs-service.feature index 5739af33c..3bf8a762c 100644 --- a/s2i/tests/features/kogito-jobs-service.feature +++ b/s2i/tests/features/kogito-jobs-service.feature @@ -20,7 +20,7 @@ Feature: Kogito-jobs-service feature. When container is started with env | variable | value | | SCRIPT_DEBUG | true | - Then container log should contain + exec java -XshowSettings:properties -jar /home/kogito/bin/kogito-jobs-service-runner.jar + Then container log should contain + exec java -XshowSettings:properties -Dquarkus.infinispan-client.use-auth=false -jar /home/kogito/bin/kogito-jobs-service-runner.jar Scenario: verify if container fails if persistence is enabled but there is no infinispan server list. When container is started with env