From 1de58bde10c07e59e392244f974e3840e75c0028 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Fri, 7 Jun 2024 12:57:10 +0200 Subject: [PATCH] Add JDK 21 and remove 8, 11 from build-images. Remove JDK pre 17 from container tests. Add JDK 21 to container tests. Update DataflowOAuthIT to dump last error output from curl. --- .github/actions/build-images/build-images.sh | 8 ++--- .../test/db/AbstractDatabaseTests.java | 23 ++----------- .../test/db/AbstractDataflowTests.java | 2 +- .../test/oauth/DataflowOAuthIT.java | 34 +++++++++++++++---- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/.github/actions/build-images/build-images.sh b/.github/actions/build-images/build-images.sh index f59bfd68d2..9e30b482a9 100755 --- a/.github/actions/build-images/build-images.sh +++ b/.github/actions/build-images/build-images.sh @@ -4,8 +4,8 @@ if [ "$TAG" == "" ]; then exit 1 fi if [ "$DEFAULT_JDK" = "" ]; then - echo "DEFAULT_JDK not found using 11" - DEFAULT_JDK=11 + echo "DEFAULT_JDK not found using 17" + DEFAULT_JDK=17 else echo "DEFAULT_JDK=$DEFAULT_JDK" fi @@ -20,7 +20,7 @@ function pack_image { fi echo "Creating: $REPO:$TAG-jdk$v" # --buildpack "paketo-buildpacks/java@10.0.0" --buildpack "paketo-buildpacks/bellsoft-liberica@10.3.2" - pack build --builder gcr.io/paketo-buildpacks/builder:base \ + pack build --builder paketobuildpacks/builder-jammy-base:latest \ --path "$JAR" \ --trust-builder --verbose \ --env BP_JVM_VERSION=$v "$REPO:$TAG-jdk$v" @@ -37,7 +37,7 @@ for ((i = 0; i < LEN; i++)); do IMAGE="$(jq -r --argjson index $i '.include[$index] | .image' .github/workflows/images.json)" ARTIFACT_ID="$(jq -r --argjson index $i '.include[$index] | .name' .github/workflows/images.json)" # 8 11 17 21 - for v in 8 11 17; do + for v in 17 21; do pack_image "$TARGET/$ARTIFACT_ID" $IMAGE $v $ARTIFACT_ID RC=$? if [ $RC -ne 0 ]; then diff --git a/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDatabaseTests.java b/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDatabaseTests.java index c095a17d27..25ba22a06c 100644 --- a/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDatabaseTests.java +++ b/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDatabaseTests.java @@ -62,35 +62,18 @@ public void testLatestSharedDb() { @Test @DataflowMain - public void testLatestSharedDbJdk8() { + public void testLatestSharedDbJdk21() { log.info("Running testLatestSharedDb()"); // start defined database this.dataflowCluster.startSkipperDatabase(getDatabaseTag()); this.dataflowCluster.startDataflowDatabase(getDatabaseTag()); // start defined skipper server and check it started - this.dataflowCluster.startSkipper(TagNames.SKIPPER_main + "-jdk8"); + this.dataflowCluster.startSkipper(TagNames.SKIPPER_main + "-jdk21"); assertSkipperServerRunning(this.dataflowCluster); // start defined dataflow server and check it started - this.dataflowCluster.startDataflow(TagNames.DATAFLOW_main + "-jdk8"); - assertDataflowServerRunning(this.dataflowCluster); - } - - @Test - @DataflowMain - public void testLatestSharedDbJdk11() { - log.info("Running testLatestSharedDb()"); - // start defined database - this.dataflowCluster.startSkipperDatabase(getDatabaseTag()); - this.dataflowCluster.startDataflowDatabase(getDatabaseTag()); - - // start defined skipper server and check it started - this.dataflowCluster.startSkipper(TagNames.SKIPPER_main + "-jdk11"); - assertSkipperServerRunning(this.dataflowCluster); - - // start defined dataflow server and check it started - this.dataflowCluster.startDataflow(TagNames.DATAFLOW_main + "-jdk11"); + this.dataflowCluster.startDataflow(TagNames.DATAFLOW_main + "-jdk21"); assertDataflowServerRunning(this.dataflowCluster); } diff --git a/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDataflowTests.java b/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDataflowTests.java index 2145f8f861..752c07bdb3 100644 --- a/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDataflowTests.java +++ b/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/db/AbstractDataflowTests.java @@ -169,7 +169,7 @@ protected List getSkipperContainers() { protected List getDataflowContainers() { ArrayList containers = new ArrayList<>(DATAFLOW_CONTAINERS); containers.add(ClusterContainer.from(TagNames.DATAFLOW_main, DATAFLOW_IMAGE_PREFIX + getDataflowLatestVersion())); - List jdkTags = Arrays.asList(8, 11, 17); + List jdkTags = Arrays.asList(17, 21); for(Integer jdk : jdkTags) { containers.add(ClusterContainer.from(TagNames.DATAFLOW_main + "-jdk" + jdk, DATAFLOW_IMAGE_PREFIX + getDataflowLatestVersion() + "-jdk" + jdk)); } diff --git a/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/oauth/DataflowOAuthIT.java b/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/oauth/DataflowOAuthIT.java index 8fee3ff5a0..2b285e52d8 100644 --- a/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/oauth/DataflowOAuthIT.java +++ b/spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/oauth/DataflowOAuthIT.java @@ -17,6 +17,7 @@ package org.springframework.cloud.dataflow.integration.test.oauth; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; import org.junit.jupiter.api.Test; import org.slf4j.Logger; @@ -27,6 +28,7 @@ import org.springframework.cloud.dataflow.integration.test.tags.Oauth; import org.springframework.cloud.dataflow.integration.test.tags.TagNames; import org.springframework.test.context.ActiveProfiles; +import org.springframework.util.StringUtils; import static org.awaitility.Awaitility.with; @@ -47,20 +49,38 @@ public void testSecuredSetup() throws Exception { // need proper networking, so use separate tools container to run // curl command as we support basic auth and if we get good response // oauth is working with dataflow and skipper. - with() - .pollInterval(5, TimeUnit.SECONDS) - .and() - .await() + + AtomicReference stderr = new AtomicReference<>(); + try { + with() + .pollInterval(5, TimeUnit.SECONDS) + .and() + .await() .ignoreExceptions() - .atMost(120, TimeUnit.SECONDS) + .atMost(90, TimeUnit.SECONDS) .until(() -> { log.debug("Checking auth using curl"); - ExecResult cmdResult = execInToolsContainer("curl", "-u", "janne:janne", "http://dataflow:9393/about"); + ExecResult cmdResult = execInToolsContainer("curl", "-v", "-u", "janne:janne", "http://dataflow:9393/about"); String response = cmdResult.getStdout(); - log.debug("Response is {}", response); + if (StringUtils.hasText(response)) { + log.debug("Response is {}", response); + } boolean ok = response.contains("\"authenticated\":true") && response.contains("\"username\":\"janne\""); log.info("Check for oauth {}", ok); + if (!ok) { + stderr.set(cmdResult.getStderr()); + } + else { + stderr.set(""); + } return ok; }); + } + finally { + String msg = stderr.get(); + if (StringUtils.hasText(msg)) { + log.error("curl error: {}", msg); + } + } } }