Skip to content

Commit

Permalink
chore(test): add config to skip pulling test images (#1466)
Browse files Browse the repository at this point in the history
* chore(test): add config to skip pulling test images

* add env var handling to integration test script

* correct reports JDP config
  • Loading branch information
andrewazores authored Apr 24, 2023
1 parent 6399bac commit 043ea78
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<cryostat.mainClass>io.cryostat.Cryostat</cryostat.mainClass>
<cryostat.rjmxPort>9091</cryostat.rjmxPort>
<cryostat.webPort>8181</cryostat.webPort>
<cryostat.itest.pullImages>always</cryostat.itest.pullImages>
<cryostat.itest.webPort>8181</cryostat.itest.webPort>
<cryostat.itest.webHost>localhost</cryostat.itest.webHost>
<cryostat.itest.podName>cryostat-itests</cryostat.itest.podName>
Expand Down Expand Up @@ -495,7 +496,7 @@
<executable>${imageBuilder}</executable>
<arguments>
<argument>run</argument>
<argument>--pull=always</argument>
<argument>--pull=${cryostat.itest.pullImages}</argument>
<argument>--pod=${cryostat.itest.podName}</argument>
<argument>--name=jfr-datasource-itest</argument>
<argument>--detach</argument>
Expand All @@ -515,7 +516,7 @@
<executable>${imageBuilder}</executable>
<arguments>
<argument>run</argument>
<argument>--pull=always</argument>
<argument>--pull=${cryostat.itest.pullImages}</argument>
<argument>--pod=${cryostat.itest.podName}</argument>
<argument>--name=grafana-itest</argument>
<argument>--env</argument>
Expand Down
9 changes: 7 additions & 2 deletions repeated-integration-tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ if [ -z "${ITEST_IMG_VERSION}" ]; then
ITEST_IMG_VERSION="${ITEST_IMG_VERSION,,}" # lowercase
fi

if [ -z "${PULL_IMAGES}" ]; then
PULL_IMAGES="always"
fi

function cleanup() {
if podman pod exists "${POD_NAME}"; then
"${MVN}" exec:exec@destroy-pod
Expand All @@ -47,6 +51,9 @@ trap cleanup EXIT
cleanup

STARTFLAGS=(
"-DfailIfNoTests=true"
"-Dcryostat.imageVersion=${ITEST_IMG_VERSION}"
"-Dcryostat.itest.pullImages=${PULL_IMAGES}"
"build-helper:regex-property@image-tag-to-lower"
"exec:exec@create-pod"
"exec:exec@start-jfr-datasource"
Expand All @@ -57,8 +64,6 @@ STARTFLAGS=(
"exec:exec@wait-for-grafana"
"failsafe:integration-test"
"failsafe:verify"
"-DfailIfNoTests=true"
"-Dcryostat.imageVersion=${ITEST_IMG_VERSION}"
)

if [ -n "$2" ]; then
Expand Down
14 changes: 9 additions & 5 deletions smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
set -x
set -e

if [ -z "${PULL_IMAGES}" ]; then
PULL_IMAGES="always"
fi

getPomProperty() {
if command -v xpath > /dev/null 2>&1 ; then
xpath -q -e "project/properties/$1/text()" pom.xml
Expand Down Expand Up @@ -198,7 +202,7 @@ runJfrDatasource() {
fi
podman run \
--name jfr-datasource \
--pull always \
--pull "${PULL_IMAGES}" \
--pod cryostat-pod \
--rm -d "${DATASOURCE_IMAGE}"
}
Expand All @@ -215,7 +219,7 @@ runGrafana() {
port="$(getPomProperty cryostat.itest.jfr-datasource.port)"
podman run \
--name grafana \
--pull always \
--pull "${PULL_IMAGES}" \
--pod cryostat-pod \
--env GF_INSTALL_PLUGINS=grafana-simple-json-datasource \
--env GF_AUTH_ANONYMOUS_ENABLED=true \
Expand All @@ -235,13 +239,13 @@ runReportGenerator() {
port="$(getPomProperty cryostat.itest.reports.port)"
podman run \
--name reports \
--pull always \
--pull "${PULL_IMAGES}" \
--pod cryostat-pod \
--label io.cryostat.connectUrl="service:jmx:remote+http://localhost:${RJMX_PORT}" \
--label io.cryostat.connectUrl="service:jmx:rmi:///jndi/rmi://localhost:${RJMX_PORT}/jmxrmi" \
--cpus 1 \
--memory 512M \
--restart on-failure \
--env JAVA_OPTIONS="-XX:ActiveProcessorCount=1 -XX:+UseSerialGC -Dorg.openjdk.jmc.flightrecorder.parser.singlethreaded=true -Dcom.sun.management.jmxremote.autodiscovery=true -Dcom.sun.management.jmxremote.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.rmi.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" \
--env JAVA_OPTS="-XX:ActiveProcessorCount=1 -Dcom.sun.management.jmxremote.autodiscovery=true -Dcom.sun.management.jmxremote.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.rmi.port=${RJMX_PORT} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" \
--env QUARKUS_HTTP_PORT="${port}" \
--rm -d "${REPORTS_IMAGE}"
}
Expand Down

0 comments on commit 043ea78

Please sign in to comment.