From 565914772ebcba8593077bf46533f973b7caf606 Mon Sep 17 00:00:00 2001 From: ran Date: Thu, 7 Sep 2023 22:28:11 +0800 Subject: [PATCH] [CI] Adjust CI to test the corresponding Pulsar image version (#696) --- .github/workflows/pr-integration-tests.yml | 8 +++++- io-amqp1_0-impl/pom.xml | 5 ---- pom.xml | 2 +- tests/Dockerfile | 27 +++++++++++++++++++ tests/build.sh | 25 +++++++++++++++++ .../io/amqp/tests/IntegrationTest.java | 9 ------- .../amqp/tests/PulsarStandaloneContainer.java | 2 +- .../io/amqp/tests/SolaceContainer.java | 2 +- 8 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 tests/Dockerfile create mode 100755 tests/build.sh diff --git a/.github/workflows/pr-integration-tests.yml b/.github/workflows/pr-integration-tests.yml index 4d4d035b..788825e7 100644 --- a/.github/workflows/pr-integration-tests.yml +++ b/.github/workflows/pr-integration-tests.yml @@ -31,7 +31,13 @@ jobs: df -h - name: Build with Maven skipTests - run: mvn clean install -DskipTests + run: | + mvn clean install -DskipTests + + - name: build test image + run: | + cd tests + ./build.sh - name: tests module run: mvn test -pl tests diff --git a/io-amqp1_0-impl/pom.xml b/io-amqp1_0-impl/pom.xml index d075ce2a..dcbe757c 100644 --- a/io-amqp1_0-impl/pom.xml +++ b/io-amqp1_0-impl/pom.xml @@ -31,11 +31,6 @@ pulsar-io-amqp1_0 - - 17 - 17 - - diff --git a/pom.xml b/pom.xml index 717ee87f..863ca609 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 2.12.6.1 1.18.22 - 2.11.0.0-rc3 + 3.0.1.2 1.8.0 2.17.1 1.7.25 diff --git a/tests/Dockerfile b/tests/Dockerfile new file mode 100644 index 00000000..f0a5ecd8 --- /dev/null +++ b/tests/Dockerfile @@ -0,0 +1,27 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +ARG PULSAR_IMAGE_TAG +FROM streamnative/pulsar:${PULSAR_IMAGE_TAG} + +### Add connector +COPY ./src/test/resources/pulsar-io-amqp1_0.nar /pulsar/connectors/pulsar-io-amqp1_0.nar +COPY ./src/test/resources/amqp1_0-source-config.yaml /pulsar/amqp1_0-source-config.yaml +COPY ./src/test/resources/amqp1_0-sink-config.yaml /pulsar/amqp1_0-sink-config.yaml +COPY ./src/test/resources/amqp1_0-source-config-session-mode.yaml /pulsar/amqp1_0-source-config-session-mode.yaml \ No newline at end of file diff --git a/tests/build.sh b/tests/build.sh new file mode 100755 index 00000000..5426f1bb --- /dev/null +++ b/tests/build.sh @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -e + +IMAGE_NAME=pulsar-io-amqp-1-0:test +PULSAR_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${pulsar.version}' --non-recursive exec:exec) +docker build --build-arg PULSAR_IMAGE_TAG="${PULSAR_VERSION}" -t "${IMAGE_NAME}" . +echo "build test image ${IMAGE_NAME} with pulsar version ${PULSAR_VERSION}" \ No newline at end of file diff --git a/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/IntegrationTest.java b/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/IntegrationTest.java index d1982fd5..64d7b60a 100644 --- a/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/IntegrationTest.java +++ b/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/IntegrationTest.java @@ -43,7 +43,6 @@ import org.awaitility.Awaitility; import org.junit.Assert; import org.junit.Test; -import org.testcontainers.containers.BindMode; import org.testcontainers.containers.Container; import org.testcontainers.containers.Network; @@ -77,14 +76,6 @@ private void test(String sourceConfigYaml) throws Exception { + "&& bin/pulsar standalone"; standaloneContainer.withExposedPorts(8080); standaloneContainer.withCommand("sh", "-c", command); - - standaloneContainer.withClasspathResourceMapping( - "pulsar-io-amqp1_0.nar", "/pulsar/connectors/pulsar-io-amqp1_0.nar", BindMode.READ_ONLY); - standaloneContainer.withClasspathResourceMapping( - sourceConfigYaml, "/pulsar/" + sourceConfigYaml, BindMode.READ_ONLY); - standaloneContainer.withClasspathResourceMapping( - "amqp1_0-sink-config.yaml", "/pulsar/amqp1_0-sink-config.yaml", BindMode.READ_ONLY); - standaloneContainer.start(); log.info("standalone container start."); diff --git a/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/PulsarStandaloneContainer.java b/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/PulsarStandaloneContainer.java index 7657354c..957db02a 100644 --- a/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/PulsarStandaloneContainer.java +++ b/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/PulsarStandaloneContainer.java @@ -30,7 +30,7 @@ */ public class PulsarStandaloneContainer extends GenericContainer { - public static final String IMAGE = "apachepulsar/pulsar:latest"; + public static final String IMAGE = "pulsar-io-amqp-1-0:test"; PulsarStandaloneContainer(String imageName) { super(imageName); diff --git a/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/SolaceContainer.java b/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/SolaceContainer.java index 48777cbc..2f0d7a0e 100644 --- a/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/SolaceContainer.java +++ b/tests/src/test/java/org/apache/pulsar/ecosystem/io/amqp/tests/SolaceContainer.java @@ -30,7 +30,7 @@ */ public class SolaceContainer extends GenericContainer { - public static final String IMAGE = "solace/solace-pubsub-standard:latest"; + public static final String IMAGE = "solace/solace-pubsub-standard:10.5"; SolaceContainer(String imageName) { super(imageName);