From 7d203326a89c90a90dbeff4f67c39563d1585d29 Mon Sep 17 00:00:00 2001 From: windwheel Date: Mon, 2 May 2022 10:34:34 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E6=8E=A5=E5=85=A5ci=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/build/retry.sh | 25 ++ .circleci/build/run_integration_group.sh | 131 ++++++ .circleci/config.yml | 9 + .github/workflows/integration-test.yml | 6 + .../.gitignore | 33 ++ .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 58727 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 + .../HELP.md | 19 + .../spring-cloud-alibaba-testcontainers/mvnw | 316 +++++++++++++ .../mvnw.cmd | 188 ++++++++ .../pom.xml | 66 +++ ...CloudAlibabaTestcontainersApplication.java | 13 + .../integration/common/ChaosContainer.java | 98 +++++ .../docker/ContainerExecException.java | 32 ++ .../docker/ContainerExecResult.java | 28 ++ .../docker/ContainerExecResultBytes.java | 12 + .../cloud/integration/utils/DockerUtils.java | 416 ++++++++++++++++++ .../src/main/resources/application.properties | 1 + ...AlibabaTestcontainersApplicationTests.java | 13 + 19 files changed, 1408 insertions(+) create mode 100755 .circleci/build/retry.sh create mode 100755 .circleci/build/run_integration_group.sh create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.jar create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md create mode 100755 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/resources/application.properties create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java diff --git a/.circleci/build/retry.sh b/.circleci/build/retry.sh new file mode 100755 index 0000000000..17934ebdd9 --- /dev/null +++ b/.circleci/build/retry.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +function fail { + echo $1 >&2 + exit 1 +} + +function retry { + local n=1 + local max=3 + local delay=10 + while true; do + "$@" && break || { + if [[ $n -lt $max ]]; then + ((n++)) + echo "Command failed. Attempt $n/$max:" + sleep $delay; + else + fail "The command has failed after $n attempts." + fi + } + done +} + +retry "$@" \ No newline at end of file diff --git a/.circleci/build/run_integration_group.sh b/.circleci/build/run_integration_group.sh new file mode 100755 index 0000000000..7c016b4310 --- /dev/null +++ b/.circleci/build/run_integration_group.sh @@ -0,0 +1,131 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +set -e +set -o pipefail +set -o errexit + +TEST_GROUP=$1 +if [ -z "$TEST_GROUP" ]; then + echo "usage: $0 [test_group]" + exit 1 +fi +shift + +# runs integration tests +mvn_run_integration_test() { + ( + RETRY="" + # wrap with retry.sh script if next parameter is "--retry" + if [[ "$1" == "--retry" ]]; then + RETRY="./build/retry.sh" + shift + fi + # skip wrapping with retry.sh script if next parameter is "--no-retry" + if [[ "$1" == "--no-retry" ]]; then + RETRY="" + shift + fi + set -x + + # run the integration tests + $RETRY mvn -B -ntp -DredirectTestOutputToFile=false -f tests/pom.xml test "$@" + ) +} + +test_group_shade() { + mvn_run_integration_test "$@" -DShadeTests -DtestForkCount=1 -DtestReuseFork=false +} + +test_group_backwards_compat() { + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-backwards-compatibility.xml -DintegrationTests + mvn_run_integration_test --retry "$@" -DBackwardsCompatTests -DtestForkCount=1 -DtestReuseFork=false +} + +test_group_cli() { + # run pulsar cli integration tests + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-cli.xml -DintegrationTests + + # run pulsar auth integration tests + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-auth.xml -DintegrationTests +} + +test_group_function() { + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-function.xml -DintegrationTests +} + +test_group_messaging() { + # run integration messaging tests + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-messaging.xml -DintegrationTests + # run integration proxy tests + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-proxy.xml -DintegrationTests + # run integration proxy with WebSocket tests + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-proxy-websocket.xml -DintegrationTests +} + +test_group_schema() { + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-schema.xml -DintegrationTests +} + +test_group_standalone() { + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-standalone.xml -DintegrationTests +} + +test_group_transaction() { + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-transaction.xml -DintegrationTests +} + +test_group_tiered_filesystem() { + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=tiered-filesystem-storage.xml -DintegrationTests +} + +test_group_tiered_jcloud() { + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=tiered-jcloud-storage.xml -DintegrationTests +} + +test_group_pulsar_connectors_thread() { + # run integration function + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-thread.xml -DintegrationTests -Dgroups=function + + # run integration source + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-thread.xml -DintegrationTests -Dgroups=source + + # run integration sink + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-thread.xml -DintegrationTests -Dgroups=sink +} + +test_group_pulsar_connectors_process() { + # run integration function + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -Dgroups=function + + # run integration source + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -Dgroups=source + + # run integraion sink + mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -Dgroups=sink +} + +test_group_sql() { + mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-sql.xml -DintegrationTests -DtestForkCount=1 -DtestReuseFork=false +} + +test_group_pulsar_io() { + mvn_run_integration_test --no-retry "$@" -DintegrationTestSuiteFile=pulsar-io-sources.xml -DintegrationTests -Dgroups=source + mvn_run_integration_test --no-retry "$@" -DintegrationTestSuiteFile=pulsar-io-sinks.xml -DintegrationTests -Dgroups=sink +} + +test_group_pulsar_io_ora() { + mvn_run_integration_test --no-retry "$@" -DintegrationTestSuiteFile=pulsar-io-ora-source.xml -DintegrationTests -Dgroups=source -DtestRetryCount=0 +} + + + +echo "Test Group : $TEST_GROUP" +test_group_function_name="test_group_$(echo "$TEST_GROUP" | tr '[:upper:]' '[:lower:]')" +if [[ "$(LC_ALL=C type -t $test_group_function_name)" == "function" ]]; then + eval "$test_group_function_name" "$@" +else + echo "INVALID TEST GROUP" + exit 1 +fi diff --git a/.circleci/config.yml b/.circleci/config.yml index 3beeaa6250..0f0f59aa95 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,6 +32,15 @@ jobs: mkdir -p ~/junit/ find . -type f -regex ".*/target/.*-reports/.*" -exec cp {} ~/junit/ \; bash <(curl -s https://codecov.io/bash) + - run: + - name: "run install by skip tests" + if: ${{ steps.check_changes.outputs.docs_only != 'true' }} + run: mvn -q -B -ntp clean install -DskipTests + - run: + - name: run integration tests + if: ${{ steps.check_changes.outputs.docs_only != 'true' }} + run: ./build/run_integration_group.sh CLI + - store_artifacts: path: ~/junit/ destination: artifacts diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 804dab9dbb..22f36eb26d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,4 +29,10 @@ jobs: - name: Testing run: mvn clean test # run: mvn clean -Dit.enabled=true test + - name: "run install by skip tests" + if: ${{ steps.check_changes.outputs.docs_only != 'true' }} + run: mvn -q -B -ntp clean install -DskipTests + - name: run integration tests + if: ${{ steps.check_changes.outputs.docs_only != 'true' }} + run: ./build/run_integration_group.sh CLI diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore new file mode 100644 index 0000000000..549e00a2a9 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..c1dd12f17644411d6e840bd5a10c6ecda0175f18 GIT binary patch literal 58727 zcmb5W18`>1vNjyPv28mO+cqb*Z6_1kwr$(?#I}=(ZGUs`Jr}3`|DLbDUA3!L?dtC8 zUiH*ktDo+@6r@4HP=SCTA%WmZqm^Ro`Ls)bfPkcdfq?#g1(Fq27W^S8Cq^$TC?_c< zs-#ROD;6C)1wFuk7<3)nGuR^#!H;n&3*IjzXg+s8Z_S!!E0jUq(`}Itt=YdYa5Z_s z&e>2={87knpF*PKNzU;lsbk#P(l^WBvb$yEz)z+nYH43pKodrDkMp@h?;n{;K}hl>Fb^ zqx}C0|D7kg|Cj~3f7hn_zkAE}|6t|cZT|S5Hvb#3nc~C14u5UI{6#F<|FkJ0svs&S zA}S{=DXLT*BM1$`2rK%`D@vEw9l9%*=92X_2g?Fwfi=6Zfpr7+<~sgP#Bav+Df2ts zwtu~70zhqV?mrzM)}r7mMS`Hk_)NrI5K%CTtQtDxqw5iv5F0!ksIon{qqpPVnU?ds zN$|Vm{MHKEReUy>1kVfT-$3))Js0p2W_LFy3cjjZ7za0R zPdBH>y&pb0vr1|ckDpt2p$IQhwnPs5G*^b-y}sg4W!ALn}a`pY0JIa$H0$eV2T8WjWD= zWaENacQhlTyK4O!+aOXBurVR2k$eb8HVTCxy-bcHlZ4Xr!`juLAL#?t6|Ba!g9G4I zSwIt2Lla>C?C4wAZ8cKsZl9-Yd3kqE`%!5HlGdJJaFw0mu#--&**L-i|BcIdc3B$;0FC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fWvwY7Z{YOlIQ61b`j=%6{>MPs+`()Q{wq0z0?|jwRN(1IrMQsj40BHx zvBC_Xfcr;55&}MeoP_@#nz$avCh%FJfE5NNAE~fW@L7~f8Y=?Wno31128EYOK8+O! zc4Vaj-DCsB6CPH$?pQQVbb_(tg^x{$STYM_WKLtrh-_-Hq-M%Ubpt6$mCHY!B{ISD zz}grIo^bNVDw4={SA2*nDNq5`e@ZO5r4TbQpHM)~qfD9!s0h(Jf>vYd;I~j<2fD4)_>ctbwNX6S*8>i^*4 zYKI5<4}d;hM!!N|A$@eg09J|HV;!UUVIau_I~dxZp#?a3u0G)pts6GKdCNk>FKxdh_`Xu!>zO3Kv?u+W6cYJPy!@=PuY868>3|Zg} z$7galV~M`d!q(`I{;CJsq6G9>W0}H6gVY`q7S@9s8ak1r{>}*Q0JyH&f!f8(NZxhC zkn|KS64r^A1fniFel2KkxYByk%erCx9UgFLI)`yuA)X z8SU?6kj!numPNCAj}>1ipax(t{%rxU;6`(Nqt$~Z4~76TQ$9d8l`yJ}rniII%HbH= zlS_7o!qB{55at^>N!Voer%)`KMh9Yd@Z?~nc19*hs)NGN954`O9zA&&vJHbm&|D@E za(&z6A=3NfC;>I)hlI@ulP8E@W-ziGe{iCf_mHvWGldxw8{ng-hI({EtOdALnD9zG ze)fU?I(DNt)Bzdd9Cs^>!|+2!xv1SK=I zJ+y_;=Sq-zqD~GKy@{5(my&aPgFfGY&_mayR_)?dF_^Fwc-n!UAG+fQQGfjWE-1MF YM{}PByk10KD_nuQ4E7Du?}+~TKh4V)`~Uy| literal 0 HcmV?d00001 diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..b7cb93e705 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md new file mode 100644 index 0000000000..35f58087f3 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md @@ -0,0 +1,19 @@ +# Getting Started + +### Reference Documentation + +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image) +* [Spring Web](https://docs.spring.io/spring-boot/docs/2.6.7/reference/htmlsingle/#boot-features-developing-web-applications) + +### Guides + +The following guides illustrate how to use some features concretely: + +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) + diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw new file mode 100755 index 0000000000..8a8fb2282d --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd new file mode 100644 index 0000000000..1d8ab018ea --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml new file mode 100644 index 0000000000..418dd3395f --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + + com.alibaba.cloud + spring-cloud-alibaba-tests + ${revision} + + + spring-cloud-alibaba-testcontainers + spring-cloud-alibaba-testcontainers + spring-cloud-alibaba-testcontainers + + 11 + 1.7.25 + 1.16.3 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.testcontainers + testcontainers-bom + ${testcontainers.version} + pom + import + + + org.projectlombok + lombok + + + org.testcontainers + testcontainers + ${testcontainers.version} + + + org.assertj + assertj-core + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java new file mode 100644 index 0000000000..fd72cf1845 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java @@ -0,0 +1,13 @@ +package com.alibaba.cloud.integration; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringCloudAlibabaTestcontainersApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringCloudAlibabaTestcontainersApplication.class, args); + } + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java new file mode 100644 index 0000000000..e946042ed5 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java @@ -0,0 +1,98 @@ +package com.alibaba.cloud.integration.common; + +import com.alibaba.cloud.integration.docker.ContainerExecResult; +import com.alibaba.cloud.integration.utils.DockerUtils; +import com.github.dockerjava.api.DockerClient; +import lombok.extern.slf4j.Slf4j; +import org.testcontainers.containers.GenericContainer; + +import java.util.Base64; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; + +@Slf4j +public class ChaosContainer> extends GenericContainer { + + protected final String clusterName; + + protected ChaosContainer(String clusterName, String image) { + super(image); + this.clusterName = clusterName; + } + + @Override + protected void configure() { + super.configure(); + addEnv("MALLOC_ARENA_MAX", "1"); + } + + protected void beforeStop() { + if (null == getContainerId()) { + return; + } + + // dump the container log + DockerUtils.dumpContainerLogToTarget( + getDockerClient(), + getContainerId() + ); + } + + @Override + public void stop() { + beforeStop(); + super.stop(); + } + + protected void tailContainerLog() { + withLogConsumer(item -> log.info(item.getUtf8String())); + } + + public void putFile(String path, byte[] contents) throws Exception { + String base64contents = Base64.getEncoder().encodeToString(contents); + String cmd = String.format("echo %s | base64 -d > %s", base64contents, path); + execCmd("bash", "-c", cmd); + } + + public ContainerExecResult execCmd(String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommand(client, dockerId, commands); + } + + public CompletableFuture execCmdAsync(String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsync(client, dockerId, commands); + } + + public ContainerExecResult execCmdAsUser(String userId, String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsUser(userId, client, dockerId, commands); + } + + public CompletableFuture execCmdAsyncAsUser(String userId, String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsyncAsUser(userId, client, dockerId, commands); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ChaosContainer)) { + return false; + } + + ChaosContainer another = (ChaosContainer) o; + return clusterName.equals(another.clusterName) + && super.equals(another); + } + + @Override + public int hashCode() { + return 31 * super.hashCode() + Objects.hash( + clusterName); + } + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java new file mode 100644 index 0000000000..c9089ff417 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java @@ -0,0 +1,32 @@ +/** + * 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. + */ +package com.alibaba.cloud.integration.docker; + +public class ContainerExecException extends Exception { + private final ContainerExecResult result; + + public ContainerExecException(String cmd, String containerId, ContainerExecResult result) { + super(String.format("%s failed on %s with error code %d", cmd, containerId, result.getExitCode())); + this.result = result; + } + + public ContainerExecResult getResult() { + return result; + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java new file mode 100644 index 0000000000..4c90845ced --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java @@ -0,0 +1,28 @@ +package com.alibaba.cloud.integration.docker; + +import lombok.Data; + +import static org.assertj.core.api.Assertions.assertThat; + +@Data(staticConstructor = "of") +public class ContainerExecResult { + + private final int exitCode; + private final String stdout; + private final String stderr; + + public void assertNoOutput() { + assertNoStdout(); + assertNoStderr(); + } + + public void assertNoStdout() { + assertThat(stdout.isEmpty()) + .isEqualTo("stdout should be empty, but was '" + stdout + "'"); + } + + public void assertNoStderr() { + assertThat(stdout.isEmpty()) + .isEqualTo("stderr should be empty, but was '" + stderr + "'"); + } +} \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java new file mode 100644 index 0000000000..2441851e09 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java @@ -0,0 +1,12 @@ +package com.alibaba.cloud.integration.docker; + +import lombok.Data; + +@Data(staticConstructor = "of") +public class ContainerExecResultBytes { + + private final int exitCode; + private final byte[] stdout; + private final byte[] stderr; + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java new file mode 100644 index 0000000000..bacd9a24b1 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java @@ -0,0 +1,416 @@ +/** + * 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. + */ +package com.alibaba.cloud.integration.utils; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.zip.GZIPOutputStream; + +import com.alibaba.cloud.integration.docker.ContainerExecException; +import com.alibaba.cloud.integration.docker.ContainerExecResult; +import com.alibaba.cloud.integration.docker.ContainerExecResultBytes; +import com.github.dockerjava.api.DockerClient; +import com.github.dockerjava.api.async.ResultCallback; +import com.github.dockerjava.api.command.InspectContainerResponse; +import com.github.dockerjava.api.command.InspectExecResponse; +import com.github.dockerjava.api.exception.NotFoundException; +import com.github.dockerjava.api.model.ContainerNetwork; +import com.github.dockerjava.api.model.Frame; +import com.github.dockerjava.api.model.StreamType; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.apache.commons.compress.utils.IOUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public class DockerUtils { + private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class); + + private static File getTargetDirectory(String containerId) { + String base = System.getProperty("maven.buildDirectory"); + if (base == null) { + base = "target"; + } + File directory = new File(base + "/container-logs/" + containerId); + if (!directory.exists() && !directory.mkdirs()) { + LOG.error("Error creating directory for container logs."); + } + return directory; + } + + public static void dumpContainerLogToTarget(DockerClient dockerClient, String containerId) { + final String containerName = getContainerName(dockerClient, containerId); + File output = getUniqueFileInTargetDirectory(containerName, "docker", ".log"); + try (OutputStream os = new BufferedOutputStream(new FileOutputStream(output))) { + CompletableFuture future = new CompletableFuture<>(); + dockerClient.logContainerCmd(containerName).withStdOut(true) + .withStdErr(true).withTimestamps(true).exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + } + + @Override + public void onNext(Frame object) { + try { + os.write(object.getPayload()); + } catch (IOException e) { + onError(e); + } + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + future.complete(true); + } + }); + future.get(); + } catch (RuntimeException | ExecutionException | IOException e) { + LOG.error("Error dumping log for {}", containerName, e); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + LOG.info("Interrupted dumping log from container {}", containerName, ie); + } + } + + private static File getUniqueFileInTargetDirectory(String containerName, String prefix, String suffix) { + return getUniqueFileInDirectory(getTargetDirectory(containerName), prefix, suffix); + } + + private static File getUniqueFileInDirectory(File directory, String prefix, String suffix) { + File file = new File(directory, prefix + suffix); + int i = 0; + while (file.exists()) { + LOG.info("{} exists, incrementing", file); + file = new File(directory, prefix + "_" + (i++) + suffix); + } + return file; + } + + private static String getContainerName(DockerClient dockerClient, String containerId) { + final InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(containerId).exec(); + // docker api returns names prefixed with "/", it's part of it's legacy design, + // this removes it to be consistent with what docker ps shows. + return inspectContainerResponse.getName().replace("/", ""); + } + + public static void dumpContainerDirToTargetCompressed(DockerClient dockerClient, String containerId, + String path) { + final String containerName = getContainerName(dockerClient, containerId); + final String baseName = path.replace("/", "-").replaceAll("^-", ""); + File output = getUniqueFileInTargetDirectory(containerName, baseName, ".tar.gz"); + try (InputStream dockerStream = dockerClient.copyArchiveFromContainerCmd(containerId, path).exec(); + OutputStream os = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(output)))) { + IOUtils.copy(dockerStream, os); + } catch (RuntimeException | IOException e) { + if (!(e instanceof NotFoundException)) { + LOG.error("Error reading dir from container {}", containerName, e); + } + } + } + + public static void dumpContainerLogDirToTarget(DockerClient docker, String containerId, + String path) { + File targetDirectory = getTargetDirectory(containerId); + try (InputStream dockerStream = docker.copyArchiveFromContainerCmd(containerId, path).exec(); + TarArchiveInputStream stream = new TarArchiveInputStream(dockerStream)) { + TarArchiveEntry entry = stream.getNextTarEntry(); + while (entry != null) { + if (entry.isFile()) { + File output = new File(targetDirectory, entry.getName().replace("/", "-")); + Files.copy(stream, output.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + entry = stream.getNextTarEntry(); + } + } catch (RuntimeException | IOException e) { + LOG.error("Error reading logs from container {}", containerId, e); + } + } + + public static String getContainerIP(DockerClient docker, String containerId) { + for (Map.Entry e : docker.inspectContainerCmd(containerId) + .exec().getNetworkSettings().getNetworks().entrySet()) { + return e.getValue().getIpAddress(); + } + throw new IllegalArgumentException("Container " + containerId + " has no networks"); + } + + public static ContainerExecResult runCommand(DockerClient docker, + String containerId, + String... cmd) + throws ContainerExecException, ExecutionException, InterruptedException { + try { + return runCommandAsync(docker, containerId, cmd).get(); + } catch (ExecutionException e) { + if (e.getCause() instanceof ContainerExecException) { + throw (ContainerExecException) e.getCause(); + } + throw e; + } + } + + public static ContainerExecResult runCommandAsUser(String userId, + DockerClient docker, + String containerId, + String... cmd) + throws ContainerExecException, ExecutionException, InterruptedException { + try { + return runCommandAsyncAsUser(userId, docker, containerId, cmd).get(); + } catch (ExecutionException e) { + if (e.getCause() instanceof ContainerExecException) { + throw (ContainerExecException) e.getCause(); + } + throw e; + } + } + + public static CompletableFuture runCommandAsyncAsUser(String userId, + DockerClient dockerClient, + String containerId, + String... cmd) { + String execId = dockerClient.execCreateCmd(containerId) + .withCmd(cmd) + .withAttachStderr(true) + .withAttachStdout(true) + .withUser(userId) + .exec() + .getId(); + return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + public static CompletableFuture runCommandAsync(DockerClient dockerClient, + String containerId, + String... cmd) { + String execId = dockerClient.execCreateCmd(containerId) + .withCmd(cmd) + .withAttachStderr(true) + .withAttachStdout(true) + .exec() + .getId(); + return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + private static CompletableFuture runCommandAsync(String execId, + DockerClient dockerClient, + String containerId, + String... cmd) { + CompletableFuture future = new CompletableFuture<>(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + StringBuilder stdout = new StringBuilder(); + StringBuilder stderr = new StringBuilder(); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", containerName, cmdString); + } + + @Override + public void onNext(Frame object) { + LOG.info("DOCKER.exec({}:{}): {}", containerName, cmdString, object); + if (StreamType.STDOUT == object.getStreamType()) { + stdout.append(new String(object.getPayload(), UTF_8)); + } else if (StreamType.STDERR == object.getStreamType()) { + stderr.append(new String(object.getPayload(), UTF_8)); + } + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); + + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); + int retCode = resp.getExitCode(); + ContainerExecResult result = ContainerExecResult.of( + retCode, + stdout.toString(), + stderr.toString() + ); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, retCode); + + if (retCode != 0) { + LOG.error( + "DOCKER.exec({}:{}): completed with non zero return code: {}\nstdout: {}\nstderr:" + + " {}", + containerName, cmdString, result.getExitCode(), result.getStdout(), + result.getStderr()); + future.completeExceptionally(new ContainerExecException(cmdString, containerId, result)); + } else { + future.complete(result); + } + } + }); + return future; + } + + public static ContainerExecResultBytes runCommandWithRawOutput(DockerClient dockerClient, + String containerId, + String... cmd) throws ContainerExecException { + CompletableFuture future = new CompletableFuture<>(); + String execId = dockerClient.execCreateCmd(containerId) + .withCmd(cmd) + .withAttachStderr(true) + .withAttachStdout(true) + .exec() + .getId(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + ByteArrayOutputStream stdout = new ByteArrayOutputStream(); + ByteArrayOutputStream stderr = new ByteArrayOutputStream(); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", containerName, cmdString); + } + + @Override + public void onNext(Frame object) { + try { + if (StreamType.STDOUT == object.getStreamType()) { + stdout.write(object.getPayload()); + } else if (StreamType.STDERR == object.getStreamType()) { + stderr.write(object.getPayload()); + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); + future.complete(true); + } + }); + future.join(); + + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); + int retCode = resp.getExitCode(); + + ContainerExecResultBytes result = ContainerExecResultBytes.of( + retCode, + stdout.toByteArray(), + stderr.toByteArray()); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, retCode); + + if (retCode != 0) { + throw new ContainerExecException(cmdString, containerId, null); + } + return result; + } + + public static CompletableFuture runCommandAsyncWithLogging(DockerClient dockerClient, + String containerId, String... cmd) { + CompletableFuture future = new CompletableFuture<>(); + String execId = dockerClient.execCreateCmd(containerId) + .withCmd(cmd) + .withAttachStderr(true) + .withAttachStdout(true) + .exec() + .getId(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", containerName, cmdString); + } + + @Override + public void onNext(Frame object) { + LOG.info("DOCKER.exec({}:{}): {}", containerName, cmdString, object); + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); + int retCode = resp.getExitCode(); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, retCode); + future.complete(retCode); + } + }); + return future; + } + + private static InspectExecResponse waitForExecCmdToFinish(DockerClient dockerClient, String execId) { + InspectExecResponse resp = dockerClient.inspectExecCmd(execId).exec(); + while (resp.isRunning()) { + try { + Thread.sleep(200); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + throw new RuntimeException(ie); + } + resp = dockerClient.inspectExecCmd(execId).exec(); + } + return resp; + } + + public static Optional getContainerCluster(DockerClient docker, String containerId) { + return Optional.ofNullable(docker.inspectContainerCmd(containerId) + .exec().getConfig().getLabels().get("cluster")); + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/resources/application.properties b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/resources/application.properties new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java new file mode 100644 index 0000000000..2938c97d38 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java @@ -0,0 +1,13 @@ +package com.alibaba.cloud.integration; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class SpringCloudAlibabaTestcontainersApplicationTests { + + @Test + void contextLoads() { + } + +} From fa0a109e6c67bf3a422f6d9fe439908ddf2b22e1 Mon Sep 17 00:00:00 2001 From: windwheel Date: Mon, 2 May 2022 10:40:48 +0800 Subject: [PATCH 02/26] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=89=A7=E8=A1=8C=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/build/run_integration_group.sh | 85 ------------------------ 1 file changed, 85 deletions(-) diff --git a/.circleci/build/run_integration_group.sh b/.circleci/build/run_integration_group.sh index 7c016b4310..474cba4200 100755 --- a/.circleci/build/run_integration_group.sh +++ b/.circleci/build/run_integration_group.sh @@ -34,91 +34,6 @@ mvn_run_integration_test() { ) } -test_group_shade() { - mvn_run_integration_test "$@" -DShadeTests -DtestForkCount=1 -DtestReuseFork=false -} - -test_group_backwards_compat() { - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-backwards-compatibility.xml -DintegrationTests - mvn_run_integration_test --retry "$@" -DBackwardsCompatTests -DtestForkCount=1 -DtestReuseFork=false -} - -test_group_cli() { - # run pulsar cli integration tests - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-cli.xml -DintegrationTests - - # run pulsar auth integration tests - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-auth.xml -DintegrationTests -} - -test_group_function() { - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-function.xml -DintegrationTests -} - -test_group_messaging() { - # run integration messaging tests - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-messaging.xml -DintegrationTests - # run integration proxy tests - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-proxy.xml -DintegrationTests - # run integration proxy with WebSocket tests - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-proxy-websocket.xml -DintegrationTests -} - -test_group_schema() { - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-schema.xml -DintegrationTests -} - -test_group_standalone() { - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-standalone.xml -DintegrationTests -} - -test_group_transaction() { - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-transaction.xml -DintegrationTests -} - -test_group_tiered_filesystem() { - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=tiered-filesystem-storage.xml -DintegrationTests -} - -test_group_tiered_jcloud() { - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=tiered-jcloud-storage.xml -DintegrationTests -} - -test_group_pulsar_connectors_thread() { - # run integration function - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-thread.xml -DintegrationTests -Dgroups=function - - # run integration source - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-thread.xml -DintegrationTests -Dgroups=source - - # run integration sink - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-thread.xml -DintegrationTests -Dgroups=sink -} - -test_group_pulsar_connectors_process() { - # run integration function - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -Dgroups=function - - # run integration source - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -Dgroups=source - - # run integraion sink - mvn_run_integration_test --retry "$@" -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -Dgroups=sink -} - -test_group_sql() { - mvn_run_integration_test "$@" -DintegrationTestSuiteFile=pulsar-sql.xml -DintegrationTests -DtestForkCount=1 -DtestReuseFork=false -} - -test_group_pulsar_io() { - mvn_run_integration_test --no-retry "$@" -DintegrationTestSuiteFile=pulsar-io-sources.xml -DintegrationTests -Dgroups=source - mvn_run_integration_test --no-retry "$@" -DintegrationTestSuiteFile=pulsar-io-sinks.xml -DintegrationTests -Dgroups=sink -} - -test_group_pulsar_io_ora() { - mvn_run_integration_test --no-retry "$@" -DintegrationTestSuiteFile=pulsar-io-ora-source.xml -DintegrationTests -Dgroups=source -DtestRetryCount=0 -} - echo "Test Group : $TEST_GROUP" From 629f70e9ceb287cf537b13f822f05a93912a4b8a Mon Sep 17 00:00:00 2001 From: windwheel Date: Mon, 2 May 2022 13:35:14 +0800 Subject: [PATCH 03/26] =?UTF-8?q?=E6=95=B4=E7=90=86=E9=9B=86=E6=88=90?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83=20=E7=BC=96=E5=86=99nacos?= =?UTF-8?q?=E6=8E=A5=E5=85=A5testcontainer=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloud/nacos/NacosConfigManager.java | 2 +- .../pom.xml | 21 ++ .../cloud/integration/NacosConfig.java | 18 ++ ...CloudAlibabaTestcontainersApplication.java | 13 - .../cloud/integration/UserProperties.java | 44 ++++ .../cloud/integration/common/KeyValue.java | 122 +++++++++ .../cloud/integration/common/Message.java | 238 ++++++++++++++++++ .../integration/common/NacosBootTester.java | 33 +++ .../common/RocketmqSourceTester.java | 164 ++++++++++++ .../cloud/integration/common/Schema.java | 107 ++++++++ ...AlibabaTestcontainersApplicationTests.java | 13 - .../test/nacos/NacosContainer.java | 49 ++++ .../test/nacos/NacosContainerTest.java | 84 +++++++ .../test/rocketmq/RocketmqContainer.java | 180 +++++++++++++ .../rocketmq/RocketmqDebeziumSourceTests.java | 4 + 15 files changed, 1065 insertions(+), 27 deletions(-) create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqDebeziumSourceTests.java diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigManager.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigManager.java index e27b3e06b5..477e63a978 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigManager.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/NacosConfigManager.java @@ -46,7 +46,7 @@ public NacosConfigManager(NacosConfigProperties nacosConfigProperties) { /** * Compatible with old design,It will be perfected in the future. */ - static ConfigService createConfigService( + public static ConfigService createConfigService( NacosConfigProperties nacosConfigProperties) { if (Objects.isNull(service)) { synchronized (NacosConfigManager.class) { diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index 418dd3395f..13403dd519 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -52,6 +52,27 @@ org.assertj assertj-core + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + com.alibaba.cloud + spring-cloud-starter-stream-rocketmq + ${revision} + + + + com.alibaba.cloud + spring-cloud-starter-bus-rocketmq + ${revision} + + + org.testng + testng + RELEASE + compile + diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java new file mode 100644 index 0000000000..35933aef3b --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java @@ -0,0 +1,18 @@ +package com.alibaba.cloud.integration; + +import lombok.Builder; +import lombok.Getter; + +@Builder +@Getter +public class NacosConfig { + + private String dataId; + + private String namespace; + + private String group; + + private String type; + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java deleted file mode 100644 index fd72cf1845..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.alibaba.cloud.integration; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SpringCloudAlibabaTestcontainersApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringCloudAlibabaTestcontainersApplication.class, args); - } - -} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java new file mode 100644 index 0000000000..1e025b78d6 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java @@ -0,0 +1,44 @@ +/* + * Copyright 2013-2022 the original author or authors. + * + * Licensed 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 + * + * https://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. + */ + +package com.alibaba.cloud.integration; + +import java.util.List; +import java.util.Map; + +import lombok.Data; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * + * + * @author freeman + */ +@Data +public class UserProperties { + private String name; + private Integer age; + private Map map; + private List users; + + @Data + public static class User { + private String name; + private Integer age; + } + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java new file mode 100644 index 0000000000..af868c7247 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java @@ -0,0 +1,122 @@ +package com.alibaba.cloud.integration.common; + +import java.nio.ByteBuffer; +import java.util.Objects; + +public class KeyValue { + private final K key; + private final V value; + + public KeyValue(K key, V value) { + this.key = key; + this.value = value; + } + + public K getKey() { + return key; + } + + public V getValue() { + return value; + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof KeyValue)) { + return false; + } + KeyValue another = (KeyValue) obj; + return Objects.equals(key, another.key) + && Objects.equals(value, another.value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("(key = \"") + .append(key) + .append("\", value = \"") + .append(value) + .append("\")"); + return sb.toString(); + } + + /** + * Decoder to decode key/value bytes. + */ + @FunctionalInterface + public interface KeyValueDecoder { + + /** + * Decode key and value bytes into a {@link KeyValue} pair. + * + * @param keyData key data + * @param valueData value data + * @return the decoded {@link KeyValue} pair + */ + KeyValue decode(byte[] keyData, byte[] valueData); + + } + + /** + * Encode a key and value pair into a bytes array. + * + * @param key key object to encode + * @param keyWriter a writer to encode key object + * @param value value object to encode + * @param valueWriter a writer to encode value object + * @return the encoded bytes array + */ + public static byte[] encode(K key, Schema keyWriter, + V value, Schema valueWriter) { + byte [] keyBytes; + if (key == null) { + keyBytes = new byte[0]; + } else { + keyBytes = keyWriter.encode(key); + } + + byte [] valueBytes; + if (value == null) { + valueBytes = new byte[0]; + } else { + valueBytes = valueWriter.encode(value); + } + ByteBuffer byteBuffer = ByteBuffer.allocate(4 + keyBytes.length + 4 + valueBytes.length); + byteBuffer + .putInt(key == null ? -1 : keyBytes.length) + .put(keyBytes) + .putInt(value == null ? -1 : valueBytes.length) + .put(valueBytes); + return byteBuffer.array(); + } + + /** + * Decode the value into a key/value pair. + * + * @param data the encoded bytes + * @param decoder the decoder to decode encoded key/value bytes + * @return the decoded key/value pair + */ + public static KeyValue decode(byte[] data, KeyValueDecoder decoder) { + ByteBuffer byteBuffer = ByteBuffer.wrap(data); + int keyLength = byteBuffer.getInt(); + byte[] keyBytes = keyLength == -1 ? null : new byte[keyLength]; + if (keyBytes != null) { + byteBuffer.get(keyBytes); + } + + int valueLength = byteBuffer.getInt(); + byte[] valueBytes = valueLength == -1 ? null : new byte[valueLength]; + if (valueBytes != null) { + byteBuffer.get(valueBytes); + } + + return decoder.decode(keyBytes, valueBytes); + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java new file mode 100644 index 0000000000..27a18b5454 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java @@ -0,0 +1,238 @@ +/** + * 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. + */ +package com.alibaba.cloud.integration.common; + +import java.util.Map; +import java.util.Optional; + +/** + * message abstraction . + */ + +public interface Message { + + /** + * Return the properties attached to the message. + * + *

Properties are application defined key/value pairs that will be attached to the message. + * + * @return an unmodifiable view of the properties map + */ + Map getProperties(); + + /** + * Check whether the message has a specific property attached. + * + * @param name the name of the property to check + * @return true if the message has the specified property and false if the properties is not defined + */ + boolean hasProperty(String name); + + /** + * Get the value of a specific property. + * + * @param name the name of the property + * @return the value of the property or null if the property was not defined + */ + String getProperty(String name); + + /** + * Get the raw payload of the message. + * + *

Even when using the Schema and type-safe API, an application + * has access to the underlying raw message payload. + * + * @return the byte array with the message payload + */ + byte[] getData(); + + /** + * Get the uncompressed message payload size in bytes. + * + * @return size in bytes. + */ + int size(); + + /** + * Get the de-serialized value of the message, according the configured {@link Schema}. + * + * @return the deserialized value of the message + */ + T getValue(); + + /** + * Get the publish time of this message. The publish time is the timestamp that a client publish the message. + * + * @return publish time of this message. + * @see #getEventTime() + */ + long getPublishTime(); + + + /** + * Get the producer name who produced this message. + * + * @return producer name who produced this message, null if producer name is not set. + * @since 1.22.0 + */ + String getProducerName(); + + /** + * Check whether the message has a key. + * + * @return true if the key was set while creating the message and false if the key was not set + * while creating the message + */ + boolean hasKey(); + + /** + * Get the key of the message. + * + * @return the key of the message + */ + String getKey(); + + /** + * Check whether the key has been base64 encoded. + * + * @return true if the key is base64 encoded, false otherwise + */ + boolean hasBase64EncodedKey(); + + /** + * Get bytes in key. If the key has been base64 encoded, it is decoded before being returned. + * Otherwise, if the key is a plain string, this method returns the UTF_8 encoded bytes of the string. + * @return the key in byte[] form + */ + byte[] getKeyBytes(); + + /** + * Check whether the message has a ordering key. + * + * @return true if the ordering key was set while creating the message + * false if the ordering key was not set while creating the message + */ + boolean hasOrderingKey(); + + /** + * Get the ordering key of the message. + * + * @return the ordering key of the message + */ + byte[] getOrderingKey(); + + /** + * Get the topic the message was published to. + * + * @return the topic the message was published to + */ + String getTopicName(); + + + /** + * Get message redelivery count, redelivery count maintain in broker. When client acknowledge message + * timeout, broker will dispatch message again with message redelivery count in CommandMessage defined. + * + *

Message redelivery increases monotonically in a broker, when topic switch ownership to a another broker + * redelivery count will be recalculated. + * + * @since 2.3.0 + * @return message redelivery count + */ + int getRedeliveryCount(); + + /** + * Get schema version of the message. + * @since 2.4.0 + * @return Schema version of the message if the message is produced with schema otherwise null. + */ + byte[] getSchemaVersion(); + + /** + * Get the schema associated to the message. + * Please note that this schema is usually equal to the Schema you passed + * during the construction of the Consumer or the Reader. + * But if you are consuming the topic using the GenericObject interface + * this method will return the schema associated with the message. + * @return The schema used to decode the payload of message. + * @see Schema#AUTO_CONSUME() + */ + default Optional> getReaderSchema() { + return Optional.empty(); + } + + /** + * Check whether the message is replicated from other cluster. + * + * @since 2.4.0 + * @return true if the message is replicated from other cluster. + * false otherwise. + */ + boolean isReplicated(); + + /** + * Get name of cluster, from which the message is replicated. + * + * @since 2.4.0 + * @return the name of cluster, from which the message is replicated. + */ + String getReplicatedFrom(); + + /** + * Release a message back to the pool. This is required only if the consumer was created with the option to pool + * messages, otherwise it will have no effect. + * + * @since 2.8.0 + */ + void release(); + + /** + * Check whether the message has a broker publish time + * + * @since 2.9.0 + * @return true if the message has a broker publish time, otherwise false. + */ + boolean hasBrokerPublishTime(); + + /** + * Get broker publish time from broker entry metadata. + * Note that only if the feature is enabled in the broker then the value is available. + * + * @since 2.9.0 + * @return broker publish time from broker entry metadata, or empty if the feature is not enabled in the broker. + */ + Optional getBrokerPublishTime(); + + /** + * Check whether the message has a index. + * + * @since 2.9.0 + * @return true if the message has a index, otherwise false. + */ + boolean hasIndex(); + + /** + * Get index from broker entry metadata. + * Note that only if the feature is enabled in the broker then the value is available. + * + * @since 2.9.0 + * @return index from broker entry metadata, or empty if the feature is not enabled in the broker. + */ + Optional getIndex(); +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java new file mode 100644 index 0000000000..addb0b7910 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java @@ -0,0 +1,33 @@ +package com.alibaba.cloud.integration.common; + +import com.alibaba.cloud.integration.NacosConfig; +import com.alibaba.cloud.integration.UserProperties; +import com.alibaba.cloud.nacos.NacosConfigManager; +import com.alibaba.cloud.nacos.NacosConfigProperties; +import com.alibaba.nacos.api.config.ConfigService; +import com.alibaba.nacos.api.exception.NacosException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.GenericContainer; + +public abstract class NacosBootTester { + + private Logger logger = LoggerFactory.getLogger(NacosBootTester.class); + + public void vaildateUpdateState(NacosConfig nacosConfig, NacosConfigProperties properties, UserProperties userProperties) throws NacosException { + + ConfigService configService = NacosConfigManager.createConfigService(properties); + String content = uploadFile(userProperties); + try{ + configService.publishConfig(nacosConfig.getDataId(),nacosConfig.getGroup(),content,nacosConfig.getType()); + }finally { + logger.info("nacos 配置文件已经上传完成"); + } + } + + /** + * nacos update yaml + */ + protected abstract String uploadFile(UserProperties userProperties); + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java new file mode 100644 index 0000000000..43178e0fd6 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java @@ -0,0 +1,164 @@ +package com.alibaba.cloud.integration.common; + +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.junit.Assert; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.shaded.com.google.common.collect.Maps; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + +@Getter +@Slf4j +public abstract class RocketmqSourceTester { + + public static final String INSERT = "INSERT"; + + public static final String DELETE = "DELETE"; + + public static final String UPDATE = "UPDATE"; + + protected final String sourceType; + protected final Map sourceConfig; + + protected int numEntriesToInsert = 1; + protected int numEntriesExpectAfterStart = 9; + + public static final Set DEBEZIUM_FIELD_SET = new HashSet() {{ + add("before"); + add("after"); + add("source"); + add("op"); + add("ts_ms"); + add("transaction"); + }}; + + protected RocketmqSourceTester(String sourceType) { + this.sourceType = sourceType; + this.sourceConfig = Maps.newHashMap(); + } + + public abstract void setServiceContainer(ServiceContainerT serviceContainer); + + public String sourceType() { + return sourceType; + } + + public Map sourceConfig() { + return sourceConfig; + } + + public abstract void prepareSource() throws Exception; + + public abstract void prepareInsertEvent() throws Exception; + + public abstract void prepareDeleteEvent() throws Exception; + + public abstract void prepareUpdateEvent() throws Exception; + + public abstract Map produceSourceMessages(int numMessages) throws Exception; + + public void validateSourceResult(Consumer consumer, int number, + String eventType, String converterClassName) throws Exception { + doPreValidationCheck(eventType); + if (converterClassName.endsWith("AvroConverter")) { + validateSourceResultAvro(consumer, number, eventType); + } else { + validateSourceResultJson(consumer, number, eventType); + } + doPostValidationCheck(eventType); + } + + /** + * Execute before regular validation to check database-specific state. + */ + public void doPreValidationCheck(String eventType) { + log.info("pre-validation of {}", eventType); + } + + /** + * Execute after regular validation to check database-specific state. + */ + public void doPostValidationCheck(String eventType) { + log.info("post-validation of {}", eventType); + } + + public void validateSourceResultJson(Consumer> consumer, int number, String eventType) throws Exception { + int recordsNumber = 0; +// Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); +// while(msg != null) { +// recordsNumber ++; +// final String key = new String(msg.getValue().getKey()); +// final String value = new String(msg.getValue().getValue()); +// log.info("Received message: key = {}, value = {}.", key, value); +// Assert.assertTrue(key.contains(this.keyContains())); +// Assert.assertTrue(value.contains(this.valueContains())); +// if (eventType != null) { +// Assert.assertTrue(value.contains(this.eventContains(eventType, true))); +// } +// consumer.acknowledge(msg); +// msg = consumer.receive(1, TimeUnit.SECONDS); +// } +// +// Assert.assertEquals(recordsNumber, number); +// log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); + } + + public void validateSourceResultAvro(Consumer> consumer, + int number, String eventType) throws Exception { + int recordsNumber = 0; +// Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); +// while(msg != null) { +// recordsNumber ++; +// K keyRecord = msg.getValue().getKey(); +// Assert.assertNotNull(keyRecord.getFields()); +// Assert.assertTrue(keyRecord.getFields().size() > 0); +// +// V valueRecord = msg.getValue().getValue(); +// Assert.assertNotNull(valueRecord.getFields()); +// Assert.assertTrue(valueRecord.getFields().size() > 0); +// +// log.info("Received message: key = {}, value = {}.", keyRecord.getNativeObject(), valueRecord.getNativeObject()); +// for (Field field : valueRecord.getFields()) { +// log.info("validating field {}", field.getName()); +// Assert.assertTrue(DEBEZIUM_FIELD_SET.contains(field.getName())); +// } +// +// if (eventType != null) { +// String op = valueRecord.getField("op").toString(); +// Assert.assertEquals(this.eventContains(eventType, false), op); +// } +// consumer.acknowledge(msg); +// msg = consumer.receive(1, TimeUnit.SECONDS); +// } +// +// Assert.assertEquals(recordsNumber, number); +// log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); + } + + public int initialDelayForMsgReceive() { + return 2; + } + + public String keyContains() { + return "dbserver1.inventory.products.Key"; + } + + public String valueContains() { + return "dbserver1.inventory.products.Value"; + } + + public String eventContains(String eventType, boolean isJson) { + if (eventType.equals(INSERT)) { + return isJson ? "\"op\":\"c\"" : "c"; + } else if (eventType.equals(UPDATE)) { + return isJson ? "\"op\":\"u\"" : "u"; + } else { + return isJson ? "\"op\":\"d\"" : "d"; + } + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java new file mode 100644 index 0000000000..cd6000982f --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java @@ -0,0 +1,107 @@ +/** + * 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. + */ +package com.alibaba.cloud.integration.common; + +import java.nio.ByteBuffer; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; +import java.util.Optional; + + +/** + * Message schema definition. + */ +public interface Schema extends Cloneable{ + + /** + * Check if the message is a valid object for this schema. + * + *

The implementation can choose what its most efficient approach to validate the schema. + * If the implementation doesn't provide it, it will attempt to use {@link #decode(byte[])} + * to see if this schema can decode this message or not as a validation mechanism to verify + * the bytes. + * + * @param message the messages to verify + * @throws SchemaSerializationException if it is not a valid message + */ + default void validate(byte[] message) { + decode(message); + } + + /** + * Encode an object representing the message content into a byte array. + * + * @param message + * the message object + * @return a byte array with the serialized content + * @throws SchemaSerializationException + * if the serialization fails + */ + byte[] encode(T message); + + /** + * Returns whether this schema supports versioning. + * + *

Most of the schema implementations don't really support schema versioning, or it just doesn't + * make any sense to support schema versionings (e.g. primitive schemas). Only schema returns + * {@link GenericRecord} should support schema versioning. + * + *

If a schema implementation returns false, it should implement {@link #decode(byte[])}; + * while a schema implementation returns true, it should implement {@link #decode(byte[], byte[])} + * instead. + * + * @return true if this schema implementation supports schema versioning; otherwise returns false. + */ + default boolean supportSchemaVersioning() { + return false; + } + + + /** + * Decode a byte array into an object using the schema definition and deserializer implementation. + * + * @param bytes + * the byte array to decode + * @return the deserialized object + */ + default T decode(byte[] bytes) { + // use `null` to indicate ignoring schema version + return decode(bytes, null); + } + + /** + * Decode a byte array into an object using a given version. + * + * @param bytes + * the byte array to decode + * @param schemaVersion + * the schema version to decode the object. null indicates using latest version. + * @return the deserialized object + */ + default T decode(byte[] bytes, byte[] schemaVersion) { + // ignore version by default (most of the primitive schema implementations ignore schema version) + return decode(bytes); + } + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java deleted file mode 100644 index 2938c97d38..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/SpringCloudAlibabaTestcontainersApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.alibaba.cloud.integration; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class SpringCloudAlibabaTestcontainersApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java new file mode 100644 index 0000000000..fa833e9b03 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java @@ -0,0 +1,49 @@ +package com.alibaba.cloud.integration.test.nacos; + +import com.alibaba.cloud.integration.common.ChaosContainer; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; + +import java.time.Duration; +import java.time.temporal.ChronoUnit; + + +public class NacosContainer> extends ChaosContainer { + + + private static final String NAME = "nacos"; + + private static final Integer NACOS_PORT = 8092; + + private static final Integer NACOS_SERVER_PORT = 8848; + + public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", + ""); + + @Override + protected void configure() { + super.configure(); + this.withNetworkAliases(NAME) + .withExposedPorts(NACOS_PORT) + .withCreateContainerCmdModifier( createContainerCmd -> { + createContainerCmd.withHostName(NAME); + createContainerCmd.withName(clusterName + "-" + NAME); + } ); + + } + + public NacosContainer(String clusterName, String image) { + super(clusterName, image); + withExposedPorts(NACOS_PORT) + .withCommand("./startup.sh -m standalone") + //定义前置动作 nacos-server是否启动 + .waitingFor(new HttpWaitStrategy() + .forPort(NACOS_SERVER_PORT) + .forStatusCode(200) + .withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS))); + + } + + + + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java new file mode 100644 index 0000000000..a3b4b27be8 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java @@ -0,0 +1,84 @@ +package com.alibaba.cloud.integration.test.nacos; + +import com.alibaba.cloud.integration.NacosConfig; +import com.alibaba.cloud.integration.UserProperties; +import com.alibaba.cloud.integration.common.NacosBootTester; +import com.alibaba.cloud.nacos.NacosConfigManager; +import com.alibaba.cloud.nacos.NacosConfigProperties; +import com.alibaba.nacos.api.config.ConfigService; +import com.alibaba.nacos.api.exception.NacosException; +import lombok.extern.slf4j.Slf4j; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; + +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; + +@Slf4j +public class NacosContainerTest extends NacosBootTester { + + private NacosContainer nacosContainer; + private static final String image = "freemanlau/nacos:1.4.2"; + + @Override + public void vaildateUpdateState(NacosConfig nacosConfig, NacosConfigProperties properties, UserProperties userProperties) throws NacosException { + super.vaildateUpdateState(nacosConfig, properties, userProperties); + } + + @Override + protected String uploadFile(UserProperties userProperties) { + + try{ + + + String content = + "configdata:\n" + + " user:\n" + + " age: 22\n" + + " name: freeman1123\n" + + " map:\n" + + " hobbies:\n" + + " - art\n" + + " - programming\n" + + " - movie\n" + + " intro: Hello, I'm freeman\n" + + " extra: yo~\n" + + " users:\n" + + " - name: dad\n" + + " age: 20\n" + + " - name: mom\n" + + " age: 18"; + return content; + }catch (Exception ex){ + log.error("Nacos pulish failed"); + return null; + } + } + + + + @Before + public void setUp() throws Exception{ + nacosContainer = new NacosContainer("nacos12133131",image); + nacosContainer.start(); + } + + @After + public void cleanup() throws Exception{ + + } + + @Test + public void testNacosStartUp() throws Exception{ + NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); + UserProperties userProperties = new UserProperties(); + NacosConfig nacosConfig = NacosConfig.builder(). + build(); + vaildateUpdateState(nacosConfig,nacosConfigProperties,userProperties); + } + + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java new file mode 100644 index 0000000000..9edb51775e --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java @@ -0,0 +1,180 @@ +package com.alibaba.cloud.integration.test.rocketmq; + +import java.time.Duration; +import java.util.Objects; +import java.util.UUID; + +import com.alibaba.cloud.integration.common.ChaosContainer; +import com.alibaba.cloud.integration.utils.DockerUtils; +import lombok.extern.slf4j.Slf4j; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; + +import static java.time.temporal.ChronoUnit.SECONDS; + +@Slf4j +public abstract class RocketmqContainer> extends ChaosContainer { + + public static final int INVALID_PORT = -1; + public static final int ZK_PORT = 2181; + public static final int CS_PORT = 2184; + public static final int BOOKIE_PORT = 3181; + public static final int BROKER_PORT = 6650; + public static final int BROKER_HTTP_PORT = 8080; + + public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", + ""); + + /** + * For debugging purposes, it is useful to have the ability to leave containers running. + * This mode can be activated by setting environment variables + * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true + * After debugging, one can use this command to kill all containers that were left running: + * docker kill $(docker ps -q --filter "label=markcontainer=true") + */ + public static final boolean CONTAINERS_LEAVE_RUNNING = + Boolean.parseBoolean(System.getenv("CONTAINERS_LEAVE_RUNNING")); + + + private final String hostname; + private final String serviceName; + private final String serviceEntryPoint; + private final int servicePort; + private final int httpPort; + private final String httpPath; + + public RocketmqContainer(String clusterName, + String hostname, + String serviceName, + String serviceEntryPoint, + int servicePort, + int httpPort) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, "/metrics"); + } + + + public RocketmqContainer(String clusterName, + String hostname, + String serviceName, + String serviceEntryPoint, + int servicePort, + int httpPort, + String httpPath) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, httpPath, + DEFAULT_IMAGE_NAME); + } + + public RocketmqContainer(String clusterName, + String hostname, + String serviceName, + String serviceEntryPoint, + int servicePort, + int httpPort, + String httpPath, + String pulsarImageName) { + super(clusterName, pulsarImageName); + this.hostname = hostname; + this.serviceName = serviceName; + this.serviceEntryPoint = serviceEntryPoint; + this.servicePort = servicePort; + this.httpPort = httpPort; + this.httpPath = httpPath; + + configureLeaveContainerRunning(this); + } + + public static void configureLeaveContainerRunning( + GenericContainer container) { + if (CONTAINERS_LEAVE_RUNNING) { + // use Testcontainers reuse containers feature to leave the container running + container.withReuse(true); + // add label that can be used to find containers that are left running. + container.withLabel("markcontainer", "true"); + // add a random label to prevent reuse of containers + container.withLabel("markcontainer.random", UUID.randomUUID().toString()); + } + } + + @Override + protected void beforeStop() { + super.beforeStop(); + if (null != getContainerId()) { + DockerUtils.dumpContainerDirToTargetCompressed( + getDockerClient(), + getContainerId(), + "/var/log/pulsar" + ); + } + } + + @Override + public void stop() { + if (CONTAINERS_LEAVE_RUNNING) { + log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); + return; + } + super.stop(); + } + + @Override + public String getContainerName() { + return clusterName + "-" + hostname; + } + + @Override + protected void configure() { + super.configure(); + if (httpPort > 0) { + addExposedPorts(httpPort); + } + if (servicePort > 0) { + addExposedPort(servicePort); + } + } + + protected void beforeStart() {} + + protected void afterStart() {} + + @Override + public void start() { + if (httpPort > 0 && servicePort < 0) { + this.waitStrategy = new HttpWaitStrategy() + .forPort(httpPort) + .forStatusCode(200) + .forPath(httpPath) + .withStartupTimeout(Duration.of(300, SECONDS)); + } else if (httpPort > 0 || servicePort > 0) { + this.waitStrategy = new HostPortWaitStrategy() + .withStartupTimeout(Duration.of(300, SECONDS)); + } + this.withCreateContainerCmdModifier(createContainerCmd -> { + createContainerCmd.withHostName(hostname); + createContainerCmd.withName(getContainerName()); + createContainerCmd.withEntrypoint(serviceEntryPoint); + }); + + beforeStart(); + super.start(); + afterStart(); + log.info("[{}] Start pulsar service {} at container {}", getContainerName(), serviceName, getContainerId()); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof RocketmqContainer)) { + return false; + } + + RocketmqContainer another = (RocketmqContainer) o; + return getContainerId().equals(another.getContainerId()) + && super.equals(another); + } + + @Override + public int hashCode() { + return 31 * super.hashCode() + Objects.hash( + getContainerId()); + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqDebeziumSourceTests.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqDebeziumSourceTests.java new file mode 100644 index 0000000000..4fe8422d06 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqDebeziumSourceTests.java @@ -0,0 +1,4 @@ +package com.alibaba.cloud.integration.test.rocketmq; + +public class RocketmqDebeziumSourceTests { +} From 2846b05475ef3a33e25ab64303dc3fba9bfd8e65 Mon Sep 17 00:00:00 2001 From: windwheel Date: Mon, 2 May 2022 17:07:35 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloud/integration/common/Message.java | 238 ------------------ 1 file changed, 238 deletions(-) delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java deleted file mode 100644 index 27a18b5454..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Message.java +++ /dev/null @@ -1,238 +0,0 @@ -/** - * 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. - */ -package com.alibaba.cloud.integration.common; - -import java.util.Map; -import java.util.Optional; - -/** - * message abstraction . - */ - -public interface Message { - - /** - * Return the properties attached to the message. - * - *

Properties are application defined key/value pairs that will be attached to the message. - * - * @return an unmodifiable view of the properties map - */ - Map getProperties(); - - /** - * Check whether the message has a specific property attached. - * - * @param name the name of the property to check - * @return true if the message has the specified property and false if the properties is not defined - */ - boolean hasProperty(String name); - - /** - * Get the value of a specific property. - * - * @param name the name of the property - * @return the value of the property or null if the property was not defined - */ - String getProperty(String name); - - /** - * Get the raw payload of the message. - * - *

Even when using the Schema and type-safe API, an application - * has access to the underlying raw message payload. - * - * @return the byte array with the message payload - */ - byte[] getData(); - - /** - * Get the uncompressed message payload size in bytes. - * - * @return size in bytes. - */ - int size(); - - /** - * Get the de-serialized value of the message, according the configured {@link Schema}. - * - * @return the deserialized value of the message - */ - T getValue(); - - /** - * Get the publish time of this message. The publish time is the timestamp that a client publish the message. - * - * @return publish time of this message. - * @see #getEventTime() - */ - long getPublishTime(); - - - /** - * Get the producer name who produced this message. - * - * @return producer name who produced this message, null if producer name is not set. - * @since 1.22.0 - */ - String getProducerName(); - - /** - * Check whether the message has a key. - * - * @return true if the key was set while creating the message and false if the key was not set - * while creating the message - */ - boolean hasKey(); - - /** - * Get the key of the message. - * - * @return the key of the message - */ - String getKey(); - - /** - * Check whether the key has been base64 encoded. - * - * @return true if the key is base64 encoded, false otherwise - */ - boolean hasBase64EncodedKey(); - - /** - * Get bytes in key. If the key has been base64 encoded, it is decoded before being returned. - * Otherwise, if the key is a plain string, this method returns the UTF_8 encoded bytes of the string. - * @return the key in byte[] form - */ - byte[] getKeyBytes(); - - /** - * Check whether the message has a ordering key. - * - * @return true if the ordering key was set while creating the message - * false if the ordering key was not set while creating the message - */ - boolean hasOrderingKey(); - - /** - * Get the ordering key of the message. - * - * @return the ordering key of the message - */ - byte[] getOrderingKey(); - - /** - * Get the topic the message was published to. - * - * @return the topic the message was published to - */ - String getTopicName(); - - - /** - * Get message redelivery count, redelivery count maintain in broker. When client acknowledge message - * timeout, broker will dispatch message again with message redelivery count in CommandMessage defined. - * - *

Message redelivery increases monotonically in a broker, when topic switch ownership to a another broker - * redelivery count will be recalculated. - * - * @since 2.3.0 - * @return message redelivery count - */ - int getRedeliveryCount(); - - /** - * Get schema version of the message. - * @since 2.4.0 - * @return Schema version of the message if the message is produced with schema otherwise null. - */ - byte[] getSchemaVersion(); - - /** - * Get the schema associated to the message. - * Please note that this schema is usually equal to the Schema you passed - * during the construction of the Consumer or the Reader. - * But if you are consuming the topic using the GenericObject interface - * this method will return the schema associated with the message. - * @return The schema used to decode the payload of message. - * @see Schema#AUTO_CONSUME() - */ - default Optional> getReaderSchema() { - return Optional.empty(); - } - - /** - * Check whether the message is replicated from other cluster. - * - * @since 2.4.0 - * @return true if the message is replicated from other cluster. - * false otherwise. - */ - boolean isReplicated(); - - /** - * Get name of cluster, from which the message is replicated. - * - * @since 2.4.0 - * @return the name of cluster, from which the message is replicated. - */ - String getReplicatedFrom(); - - /** - * Release a message back to the pool. This is required only if the consumer was created with the option to pool - * messages, otherwise it will have no effect. - * - * @since 2.8.0 - */ - void release(); - - /** - * Check whether the message has a broker publish time - * - * @since 2.9.0 - * @return true if the message has a broker publish time, otherwise false. - */ - boolean hasBrokerPublishTime(); - - /** - * Get broker publish time from broker entry metadata. - * Note that only if the feature is enabled in the broker then the value is available. - * - * @since 2.9.0 - * @return broker publish time from broker entry metadata, or empty if the feature is not enabled in the broker. - */ - Optional getBrokerPublishTime(); - - /** - * Check whether the message has a index. - * - * @since 2.9.0 - * @return true if the message has a index, otherwise false. - */ - boolean hasIndex(); - - /** - * Get index from broker entry metadata. - * Note that only if the feature is enabled in the broker then the value is available. - * - * @since 2.9.0 - * @return index from broker entry metadata, or empty if the feature is not enabled in the broker. - */ - Optional getIndex(); -} From 3e8e1d318bccfbfe4d1f08cb7c1fdeed0215337e Mon Sep 17 00:00:00 2001 From: windwheel Date: Tue, 3 May 2022 18:20:45 +0800 Subject: [PATCH 05/26] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.gitignore | 33 -- .../.mvn/wrapper/maven-wrapper.jar | Bin 58727 -> 0 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 - .../HELP.md | 19 -- .../spring-cloud-alibaba-testcontainers/mvnw | 316 ------------------ .../mvnw.cmd | 188 ----------- 6 files changed, 558 deletions(-) delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.jar delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md delete mode 100755 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw delete mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore deleted file mode 100644 index 549e00a2a9..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.jar b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index c1dd12f17644411d6e840bd5a10c6ecda0175f18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 58727 zcmb5W18`>1vNjyPv28mO+cqb*Z6_1kwr$(?#I}=(ZGUs`Jr}3`|DLbDUA3!L?dtC8 zUiH*ktDo+@6r@4HP=SCTA%WmZqm^Ro`Ls)bfPkcdfq?#g1(Fq27W^S8Cq^$TC?_c< zs-#ROD;6C)1wFuk7<3)nGuR^#!H;n&3*IjzXg+s8Z_S!!E0jUq(`}Itt=YdYa5Z_s z&e>2={87knpF*PKNzU;lsbk#P(l^WBvb$yEz)z+nYH43pKodrDkMp@h?;n{;K}hl>Fb^ zqx}C0|D7kg|Cj~3f7hn_zkAE}|6t|cZT|S5Hvb#3nc~C14u5UI{6#F<|FkJ0svs&S zA}S{=DXLT*BM1$`2rK%`D@vEw9l9%*=92X_2g?Fwfi=6Zfpr7+<~sgP#Bav+Df2ts zwtu~70zhqV?mrzM)}r7mMS`Hk_)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F_^Fwc-n!UAG+fQQGfjWE-1MF YM{}PByk10KD_nuQ4E7Du?}+~TKh4V)`~Uy| diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b7cb93e705..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,2 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md deleted file mode 100644 index 35f58087f3..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/HELP.md +++ /dev/null @@ -1,19 +0,0 @@ -# Getting Started - -### Reference Documentation - -For further reference, please consider the following sections: - -* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) -* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/) -* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.7/maven-plugin/reference/html/#build-image) -* [Spring Web](https://docs.spring.io/spring-boot/docs/2.6.7/reference/htmlsingle/#boot-features-developing-web-applications) - -### Guides - -The following guides illustrate how to use some features concretely: - -* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) -* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) -* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) - diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw deleted file mode 100755 index 8a8fb2282d..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw +++ /dev/null @@ -1,316 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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 -# -# https://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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /usr/local/etc/mavenrc ] ; then - . /usr/local/etc/mavenrc - fi - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`\\unset -f command; \\command -v java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - $MAVEN_DEBUG_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" \ - "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd deleted file mode 100644 index 1d8ab018ea..0000000000 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/mvnw.cmd +++ /dev/null @@ -1,188 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause - -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% - -cmd /C exit /B %ERROR_CODE% From b93ce60cac84b7f1a3a436b3d903e788336bf954 Mon Sep 17 00:00:00 2001 From: windwheel Date: Tue, 3 May 2022 18:21:47 +0800 Subject: [PATCH 06/26] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=8E=A5=E5=85=A5ci?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {.circleci/build => build}/retry.sh | 0 {.circleci/build => build}/run_integration_group.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {.circleci/build => build}/retry.sh (100%) rename {.circleci/build => build}/run_integration_group.sh (100%) diff --git a/.circleci/build/retry.sh b/build/retry.sh similarity index 100% rename from .circleci/build/retry.sh rename to build/retry.sh diff --git a/.circleci/build/run_integration_group.sh b/build/run_integration_group.sh similarity index 100% rename from .circleci/build/run_integration_group.sh rename to build/run_integration_group.sh From bd9d64e1f6b3295313175943df7cc02b5d08530a Mon Sep 17 00:00:00 2001 From: windwheel Date: Tue, 3 May 2022 18:22:27 +0800 Subject: [PATCH 07/26] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alibaba/cloud/integration/docker/ContainerExecException.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java index c9089ff417..4c41c845e3 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java @@ -18,6 +18,7 @@ */ package com.alibaba.cloud.integration.docker; + public class ContainerExecException extends Exception { private final ContainerExecResult result; From 6f4be1f368a111f5b389e4b0f51c0f29478fb3c9 Mon Sep 17 00:00:00 2001 From: windwheel Date: Tue, 3 May 2022 18:22:50 +0800 Subject: [PATCH 08/26] clean code --- .../alibaba/cloud/integration/docker/ContainerExecException.java | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java index 4c41c845e3..c9089ff417 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java @@ -18,7 +18,6 @@ */ package com.alibaba.cloud.integration.docker; - public class ContainerExecException extends Exception { private final ContainerExecResult result; From 9b349f517c197b688ef423db155013376a2e8a4e Mon Sep 17 00:00:00 2001 From: windwheel Date: Wed, 4 May 2022 07:16:57 +0800 Subject: [PATCH 09/26] Remove redundant scripts --- build/run_integration_group.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/build/run_integration_group.sh b/build/run_integration_group.sh index 474cba4200..c5ee7798ff 100755 --- a/build/run_integration_group.sh +++ b/build/run_integration_group.sh @@ -33,14 +33,3 @@ mvn_run_integration_test() { $RETRY mvn -B -ntp -DredirectTestOutputToFile=false -f tests/pom.xml test "$@" ) } - - - -echo "Test Group : $TEST_GROUP" -test_group_function_name="test_group_$(echo "$TEST_GROUP" | tr '[:upper:]' '[:lower:]')" -if [[ "$(LC_ALL=C type -t $test_group_function_name)" == "function" ]]; then - eval "$test_group_function_name" "$@" -else - echo "INVALID TEST GROUP" - exit 1 -fi From cd5fd5bf5f32e72332ee27b1f4550f51ca06cf3f Mon Sep 17 00:00:00 2001 From: windwheel Date: Sun, 15 May 2022 17:46:47 +0800 Subject: [PATCH 10/26] Re-divide unit test modules --- .github/workflows/integration-test.yml | 1 + build/run_integration_group.sh | 2 +- pom.xml | 5 + .../intergration/nacos-docker-tests/pom.xml | 27 +++ .../integration/test/NacosContainer.java | 49 +++++ .../integration/test/NacosContainerTest.java | 77 ++++++++ .../intergration/pom.xml | 21 ++ .../rocketmq-docker-tests/pom.xml | 19 ++ .../integration/test/RocketmqContainer.java | 180 ++++++++++++++++++ .../test/RocketmqDebeziumSourceTests.java | 4 + .../nacos-config-test/pom.xml | 0 .../config/NacosConfigTestApplication.java | 0 .../tests/nacos/config/UserProperties.java | 0 .../src/main/resources/application.yml | 0 .../nacos/config/NacosConfigRefreshTest.java | 0 .../nacos/config/NacosImportCheckTest.java | 0 .../application-nacos-config-refresh.yml | 0 .../nacos-discovery-test/pom.xml | 0 .../discovery/NacosDiscoveryTestApp.java | 0 .../nacos/discovery/NacosDiscoveryTest.java | 0 .../test/resources/application-service-1.yml | 0 .../test/resources/application-service-2.yml | 0 .../{nacos-tests => nacos-old-tests}/pom.xml | 0 .../pom.xml | 49 ++++- 24 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml create mode 100644 spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java create mode 100644 spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java create mode 100644 spring-cloud-alibaba-tests/intergration/pom.xml create mode 100644 spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml create mode 100644 spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java create mode 100644 spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/pom.xml (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/NacosConfigTestApplication.java (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/UserProperties.java (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/src/main/resources/application.yml (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosConfigRefreshTest.java (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosImportCheckTest.java (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-config-test/src/test/resources/application-nacos-config-refresh.yml (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-discovery-test/pom.xml (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-discovery-test/src/main/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTestApp.java (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-discovery-test/src/test/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTest.java (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-discovery-test/src/test/resources/application-service-1.yml (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/nacos-discovery-test/src/test/resources/application-service-2.yml (100%) rename spring-cloud-alibaba-tests/{nacos-tests => nacos-old-tests}/pom.xml (100%) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 22f36eb26d..0f7404f1cf 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -36,3 +36,4 @@ jobs: if: ${{ steps.check_changes.outputs.docs_only != 'true' }} run: ./build/run_integration_group.sh CLI + diff --git a/build/run_integration_group.sh b/build/run_integration_group.sh index c5ee7798ff..222d643402 100755 --- a/build/run_integration_group.sh +++ b/build/run_integration_group.sh @@ -30,6 +30,6 @@ mvn_run_integration_test() { set -x # run the integration tests - $RETRY mvn -B -ntp -DredirectTestOutputToFile=false -f tests/pom.xml test "$@" + $RETRY mvn -B -ntp -DredirectTestOutputToFile=true -f spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml -Pmain test "$@" ) } diff --git a/pom.xml b/pom.xml index 50224c72bf..e3f4247021 100644 --- a/pom.xml +++ b/pom.xml @@ -110,6 +110,11 @@ spring-cloud-alibaba-starters spring-cloud-alibaba-coverage spring-cloud-alibaba-tests + nacos-test + intergration + nacos-docker-tests + spring-cloud-alibaba-tests/intergration + rocketmq-docker-tests diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml new file mode 100644 index 0000000000..b382c18ec0 --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml @@ -0,0 +1,27 @@ + + + + intergration + com.alibaba.cloud + 2021.0.1.1-SNAPSHOT + + 4.0.0 + + nacos-docker-tests + + + com.alibaba.cloud + spring-cloud-alibaba-testcontainers + 2021.0.1.1-SNAPSHOT + test + + + + + 8 + 8 + + + \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java new file mode 100644 index 0000000000..0a6ee21348 --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java @@ -0,0 +1,49 @@ +package com.alibaba.cloud.integration.test; + +import java.time.Duration; +import java.time.temporal.ChronoUnit; + +import com.alibaba.cloud.integration.common.ChaosContainer; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; + + +public class NacosContainer> extends ChaosContainer { + + + private static final String NAME = "nacos"; + + private static final Integer NACOS_PORT = 8092; + + private static final Integer NACOS_SERVER_PORT = 8848; + + public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", + ""); + + @Override + protected void configure() { + super.configure(); + this.withNetworkAliases(NAME) + .withExposedPorts(NACOS_PORT) + .withCreateContainerCmdModifier( createContainerCmd -> { + createContainerCmd.withHostName(NAME); + createContainerCmd.withName(clusterName + "-" + NAME); + } ); + + } + + public NacosContainer(String clusterName, String image) { + super(clusterName, image); + withExposedPorts(NACOS_PORT) + .withCommand("./startup.sh -m standalone") + //定义前置动作 nacos-server是否启动 + .waitingFor(new HttpWaitStrategy() + .forPort(NACOS_SERVER_PORT) + .forStatusCode(200) + .withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS))); + + } + + + + +} diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java new file mode 100644 index 0000000000..bdc43c86b5 --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java @@ -0,0 +1,77 @@ +package com.alibaba.cloud.integration.test; + +import com.alibaba.cloud.integration.NacosConfig; +import com.alibaba.cloud.integration.UserProperties; +import com.alibaba.cloud.integration.common.NacosBootTester; +import com.alibaba.cloud.nacos.NacosConfigProperties; +import com.alibaba.nacos.api.exception.NacosException; +import lombok.extern.slf4j.Slf4j; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +@Slf4j +public class NacosContainerTest extends NacosBootTester { + + private NacosContainer nacosContainer; + private static final String image = "freemanlau/nacos:1.4.2"; + + @Override + public void vaildateUpdateState(NacosConfig nacosConfig, NacosConfigProperties properties, UserProperties userProperties) throws NacosException { + super.vaildateUpdateState(nacosConfig, properties, userProperties); + } + + @Override + protected String uploadFile(UserProperties userProperties) { + + try{ + + + String content = + "configdata:\n" + + " user:\n" + + " age: 22\n" + + " name: freeman1123\n" + + " map:\n" + + " hobbies:\n" + + " - art\n" + + " - programming\n" + + " - movie\n" + + " intro: Hello, I'm freeman\n" + + " extra: yo~\n" + + " users:\n" + + " - name: dad\n" + + " age: 20\n" + + " - name: mom\n" + + " age: 18"; + return content; + }catch (Exception ex){ + log.error("Nacos pulish failed"); + return null; + } + } + + + + @Before + public void setUp() throws Exception{ + nacosContainer = new NacosContainer("nacos12133131",image); + nacosContainer.start(); + } + + @After + public void cleanup() throws Exception{ + + } + + @Test + public void testNacosStartUp() throws Exception{ + NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); + UserProperties userProperties = new UserProperties(); + NacosConfig nacosConfig = NacosConfig.builder(). + build(); + vaildateUpdateState(nacosConfig,nacosConfigProperties,userProperties); + } + + +} diff --git a/spring-cloud-alibaba-tests/intergration/pom.xml b/spring-cloud-alibaba-tests/intergration/pom.xml new file mode 100644 index 0000000000..322713e496 --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/pom.xml @@ -0,0 +1,21 @@ + + + + spring-cloud-alibaba + com.alibaba.cloud + 2021.0.1.1-SNAPSHOT + ../../pom.xml + + 4.0.0 + + intergration + pom + + + 8 + 8 + + + \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml new file mode 100644 index 0000000000..364357aee8 --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml @@ -0,0 +1,19 @@ + + + + intergration + com.alibaba.cloud + 2021.0.1.1-SNAPSHOT + + 4.0.0 + + rocketmq-docker-tests + + + 8 + 8 + + + \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java new file mode 100644 index 0000000000..d4ae6fe24e --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java @@ -0,0 +1,180 @@ +package com.alibaba.cloud.integration.test; + +import java.time.Duration; +import java.util.Objects; +import java.util.UUID; + +import com.alibaba.cloud.integration.common.ChaosContainer; +import com.alibaba.cloud.integration.utils.DockerUtils; +import lombok.extern.slf4j.Slf4j; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; + +import static java.time.temporal.ChronoUnit.SECONDS; + +@Slf4j +public abstract class RocketmqContainer> extends ChaosContainer { + + public static final int INVALID_PORT = -1; + public static final int ZK_PORT = 2181; + public static final int CS_PORT = 2184; + public static final int BOOKIE_PORT = 3181; + public static final int BROKER_PORT = 6650; + public static final int BROKER_HTTP_PORT = 8080; + + public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", + ""); + + /** + * For debugging purposes, it is useful to have the ability to leave containers running. + * This mode can be activated by setting environment variables + * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true + * After debugging, one can use this command to kill all containers that were left running: + * docker kill $(docker ps -q --filter "label=markcontainer=true") + */ + public static final boolean CONTAINERS_LEAVE_RUNNING = + Boolean.parseBoolean(System.getenv("CONTAINERS_LEAVE_RUNNING")); + + + private final String hostname; + private final String serviceName; + private final String serviceEntryPoint; + private final int servicePort; + private final int httpPort; + private final String httpPath; + + public RocketmqContainer(String clusterName, + String hostname, + String serviceName, + String serviceEntryPoint, + int servicePort, + int httpPort) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, "/metrics"); + } + + + public RocketmqContainer(String clusterName, + String hostname, + String serviceName, + String serviceEntryPoint, + int servicePort, + int httpPort, + String httpPath) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, httpPath, + DEFAULT_IMAGE_NAME); + } + + public RocketmqContainer(String clusterName, + String hostname, + String serviceName, + String serviceEntryPoint, + int servicePort, + int httpPort, + String httpPath, + String pulsarImageName) { + super(clusterName, pulsarImageName); + this.hostname = hostname; + this.serviceName = serviceName; + this.serviceEntryPoint = serviceEntryPoint; + this.servicePort = servicePort; + this.httpPort = httpPort; + this.httpPath = httpPath; + + configureLeaveContainerRunning(this); + } + + public static void configureLeaveContainerRunning( + GenericContainer container) { + if (CONTAINERS_LEAVE_RUNNING) { + // use Testcontainers reuse containers feature to leave the container running + container.withReuse(true); + // add label that can be used to find containers that are left running. + container.withLabel("markcontainer", "true"); + // add a random label to prevent reuse of containers + container.withLabel("markcontainer.random", UUID.randomUUID().toString()); + } + } + + @Override + protected void beforeStop() { + super.beforeStop(); + if (null != getContainerId()) { + DockerUtils.dumpContainerDirToTargetCompressed( + getDockerClient(), + getContainerId(), + "/var/log/pulsar" + ); + } + } + + @Override + public void stop() { + if (CONTAINERS_LEAVE_RUNNING) { + log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); + return; + } + super.stop(); + } + + @Override + public String getContainerName() { + return clusterName + "-" + hostname; + } + + @Override + protected void configure() { + super.configure(); + if (httpPort > 0) { + addExposedPorts(httpPort); + } + if (servicePort > 0) { + addExposedPort(servicePort); + } + } + + protected void beforeStart() {} + + protected void afterStart() {} + + @Override + public void start() { + if (httpPort > 0 && servicePort < 0) { + this.waitStrategy = new HttpWaitStrategy() + .forPort(httpPort) + .forStatusCode(200) + .forPath(httpPath) + .withStartupTimeout(Duration.of(300, SECONDS)); + } else if (httpPort > 0 || servicePort > 0) { + this.waitStrategy = new HostPortWaitStrategy() + .withStartupTimeout(Duration.of(300, SECONDS)); + } + this.withCreateContainerCmdModifier(createContainerCmd -> { + createContainerCmd.withHostName(hostname); + createContainerCmd.withName(getContainerName()); + createContainerCmd.withEntrypoint(serviceEntryPoint); + }); + + beforeStart(); + super.start(); + afterStart(); + log.info("[{}] Start pulsar service {} at container {}", getContainerName(), serviceName, getContainerId()); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof RocketmqContainer)) { + return false; + } + + RocketmqContainer another = (RocketmqContainer) o; + return getContainerId().equals(another.getContainerId()) + && super.equals(another); + } + + @Override + public int hashCode() { + return 31 * super.hashCode() + Objects.hash( + getContainerId()); + } +} diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java new file mode 100644 index 0000000000..29a2a4a403 --- /dev/null +++ b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java @@ -0,0 +1,4 @@ +package com.alibaba.cloud.integration.test; + +public class RocketmqDebeziumSourceTests { +} diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/pom.xml b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/pom.xml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/pom.xml rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/pom.xml diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/NacosConfigTestApplication.java b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/NacosConfigTestApplication.java similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/NacosConfigTestApplication.java rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/NacosConfigTestApplication.java diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/UserProperties.java b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/UserProperties.java similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/UserProperties.java rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/main/java/com/alibaba/cloud/tests/nacos/config/UserProperties.java diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/main/resources/application.yml b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/main/resources/application.yml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/main/resources/application.yml rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/main/resources/application.yml diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosConfigRefreshTest.java b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosConfigRefreshTest.java similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosConfigRefreshTest.java rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosConfigRefreshTest.java diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosImportCheckTest.java b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosImportCheckTest.java similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosImportCheckTest.java rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/test/java/com/alibaba/cloud/tests/nacos/config/NacosImportCheckTest.java diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/test/resources/application-nacos-config-refresh.yml b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/test/resources/application-nacos-config-refresh.yml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-config-test/src/test/resources/application-nacos-config-refresh.yml rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-config-test/src/test/resources/application-nacos-config-refresh.yml diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/pom.xml b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/pom.xml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/pom.xml rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/pom.xml diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/main/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTestApp.java b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/main/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTestApp.java similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/main/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTestApp.java rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/main/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTestApp.java diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/test/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTest.java b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/test/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTest.java similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/test/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTest.java rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/test/java/com/alibaba/cloud/tests/nacos/discovery/NacosDiscoveryTest.java diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/test/resources/application-service-1.yml b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/test/resources/application-service-1.yml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/test/resources/application-service-1.yml rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/test/resources/application-service-1.yml diff --git a/spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/test/resources/application-service-2.yml b/spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/test/resources/application-service-2.yml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/nacos-discovery-test/src/test/resources/application-service-2.yml rename to spring-cloud-alibaba-tests/nacos-old-tests/nacos-discovery-test/src/test/resources/application-service-2.yml diff --git a/spring-cloud-alibaba-tests/nacos-tests/pom.xml b/spring-cloud-alibaba-tests/nacos-old-tests/pom.xml similarity index 100% rename from spring-cloud-alibaba-tests/nacos-tests/pom.xml rename to spring-cloud-alibaba-tests/nacos-old-tests/pom.xml diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index 13403dd519..a8c9cc7a06 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -11,8 +11,9 @@ spring-cloud-alibaba-testcontainers spring-cloud-alibaba-testcontainers spring-cloud-alibaba-testcontainers + pom + - 11 1.7.25 1.16.3 @@ -81,7 +82,53 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + ${project.version} + ${project.build.directory} + + true + + + + + skipIntegrationTests + + + skipIntegrationTests + + + + + + main + + true + + + ../intergration/nacos-docker-tests + ../intergration/rocketmq-docker-tests + + + + From 8d16b4ded045725070c655fdf7606ef9c2e71cbf Mon Sep 17 00:00:00 2001 From: windwheel Date: Sun, 15 May 2022 17:48:09 +0800 Subject: [PATCH 11/26] remove pipline --- .circleci/config.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f0f59aa95..3beeaa6250 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,15 +32,6 @@ jobs: mkdir -p ~/junit/ find . -type f -regex ".*/target/.*-reports/.*" -exec cp {} ~/junit/ \; bash <(curl -s https://codecov.io/bash) - - run: - - name: "run install by skip tests" - if: ${{ steps.check_changes.outputs.docs_only != 'true' }} - run: mvn -q -B -ntp clean install -DskipTests - - run: - - name: run integration tests - if: ${{ steps.check_changes.outputs.docs_only != 'true' }} - run: ./build/run_integration_group.sh CLI - - store_artifacts: path: ~/junit/ destination: artifacts From 9ddb22b5d1e403b45963cfff7524f928f13f686b Mon Sep 17 00:00:00 2001 From: windwheel Date: Sun, 15 May 2022 18:07:42 +0800 Subject: [PATCH 12/26] remove deps --- pom.xml | 5 ----- spring-cloud-alibaba-tests/intergration/pom.xml | 13 +++++++++++-- .../cloud/integration/test/RocketmqContainer.java | 7 ------- spring-cloud-alibaba-tests/pom.xml | 1 - 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index e3f4247021..50224c72bf 100644 --- a/pom.xml +++ b/pom.xml @@ -110,11 +110,6 @@ spring-cloud-alibaba-starters spring-cloud-alibaba-coverage spring-cloud-alibaba-tests - nacos-test - intergration - nacos-docker-tests - spring-cloud-alibaba-tests/intergration - rocketmq-docker-tests diff --git a/spring-cloud-alibaba-tests/intergration/pom.xml b/spring-cloud-alibaba-tests/intergration/pom.xml index 322713e496..81b53156b7 100644 --- a/spring-cloud-alibaba-tests/intergration/pom.xml +++ b/spring-cloud-alibaba-tests/intergration/pom.xml @@ -3,10 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - spring-cloud-alibaba + spring-cloud-alibaba-tests com.alibaba.cloud 2021.0.1.1-SNAPSHOT - ../../pom.xml 4.0.0 @@ -18,4 +17,14 @@ 8 + + + + com.alibaba.cloud + spring-cloud-alibaba-testcontainers + 2021.0.1.1-SNAPSHOT + test + + + \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java index d4ae6fe24e..1a447b7a48 100644 --- a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java +++ b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java @@ -26,13 +26,6 @@ public abstract class RocketmqContainer> public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", ""); - /** - * For debugging purposes, it is useful to have the ability to leave containers running. - * This mode can be activated by setting environment variables - * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true - * After debugging, one can use this command to kill all containers that were left running: - * docker kill $(docker ps -q --filter "label=markcontainer=true") - */ public static final boolean CONTAINERS_LEAVE_RUNNING = Boolean.parseBoolean(System.getenv("CONTAINERS_LEAVE_RUNNING")); diff --git a/spring-cloud-alibaba-tests/pom.xml b/spring-cloud-alibaba-tests/pom.xml index a71a35a814..231578d249 100644 --- a/spring-cloud-alibaba-tests/pom.xml +++ b/spring-cloud-alibaba-tests/pom.xml @@ -14,7 +14,6 @@ spring-cloud-alibaba-test-support - nacos-tests From f572889e39c98f90dc7372cb4e7e940dfc7ac137 Mon Sep 17 00:00:00 2001 From: windwheel Date: Sun, 5 Jun 2022 18:40:37 +0800 Subject: [PATCH 13/26] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ITcase=E6=A0=87?= =?UTF-8?q?=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integration/test/NacosContainer.java | 31 +--- .../integration/test/NacosContainerTest.java | 4 +- .../cloud/integration/common/nacos/Const.java | 15 ++ .../integration/common/nacos/Params.java | 39 +++++ .../common/nacos/TextChangeParser.java | 51 ++++++ .../test/nacos/NacosContainer.java | 37 ++-- .../common/NacosAsyncRestTemplateITCase.java | 159 ++++++++++++++++++ .../test/nacos/core/HttpClient4Test.java | 48 ++++++ 8 files changed, 342 insertions(+), 42 deletions(-) create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java index 0a6ee21348..3d827612ff 100644 --- a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java +++ b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java @@ -6,41 +6,28 @@ import com.alibaba.cloud.integration.common.ChaosContainer; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; +import static com.alibaba.cloud.integration.common.nacos.Const.DEFAULT_IMAGE_NAME; +import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_PORT; -public class NacosContainer> extends ChaosContainer { - - - private static final String NAME = "nacos"; - - private static final Integer NACOS_PORT = 8092; - private static final Integer NACOS_SERVER_PORT = 8848; - - public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", - ""); +public class NacosContainer> extends ChaosContainer { @Override protected void configure() { super.configure(); - this.withNetworkAliases(NAME) - .withExposedPorts(NACOS_PORT) + this.withNetworkAliases(DEFAULT_IMAGE_NAME) + .withExposedPorts(NACOS_SERVER_PORT) .withCreateContainerCmdModifier( createContainerCmd -> { - createContainerCmd.withHostName(NAME); - createContainerCmd.withName(clusterName + "-" + NAME); + createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); + createContainerCmd.withName(clusterName + "-" + DEFAULT_IMAGE_NAME); } ); } public NacosContainer(String clusterName, String image) { super(clusterName, image); - withExposedPorts(NACOS_PORT) - .withCommand("./startup.sh -m standalone") - //定义前置动作 nacos-server是否启动 - .waitingFor(new HttpWaitStrategy() - .forPort(NACOS_SERVER_PORT) - .forStatusCode(200) - .withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS))); - + withExposedPorts(NACOS_SERVER_PORT) + .withCommand("./startup.sh -m standalone"); } diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java index bdc43c86b5..a2eac63fb8 100644 --- a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java +++ b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java @@ -10,6 +10,8 @@ import org.junit.Before; import org.junit.Test; +import static com.alibaba.cloud.integration.common.nacos.Const.DEFAULT_IMAGE_NAME; + @Slf4j public class NacosContainerTest extends NacosBootTester { @@ -55,7 +57,7 @@ protected String uploadFile(UserProperties userProperties) { @Before public void setUp() throws Exception{ - nacosContainer = new NacosContainer("nacos12133131",image); + nacosContainer = new NacosContainer(DEFAULT_IMAGE_NAME,image); nacosContainer.start(); } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java new file mode 100644 index 0000000000..d0ea0e0bde --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java @@ -0,0 +1,15 @@ +package com.alibaba.cloud.integration.common.nacos; + +public class Const { + + public static final Integer NACOS_SERVER_PORT = 8848; + + private static final String CONFIG_INSTANCE_PATH = "/nacos/v1/ns"; + + public static final String NACOS_SERVER_URL = "http://127.0.0.1:" + NACOS_SERVER_PORT + CONFIG_INSTANCE_PATH; + + public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", + "nacos-server-test"); + + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java new file mode 100644 index 0000000000..b567b1ac7e --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java @@ -0,0 +1,39 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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. + */ +package com.alibaba.cloud.integration.common.nacos; + +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; + +public class Params { + + private MultiValueMap paramMap; + + public static Params newParams() { + Params params = new Params(); + params.paramMap = new LinkedMultiValueMap(); + return params; + } + + public Params appendParam(String name, String value) { + this.paramMap.add(name, value); + return this; + } + + public MultiValueMap done() { + return paramMap; + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java new file mode 100644 index 0000000000..ddd406b990 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java @@ -0,0 +1,51 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed 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. + */ + +package com.alibaba.cloud.integration.common.nacos; + +import com.alibaba.nacos.api.config.ConfigChangeItem; +import com.alibaba.nacos.api.config.PropertyChangeType; +import com.alibaba.nacos.api.config.listener.ConfigChangeParser; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class TextChangeParser implements ConfigChangeParser { + @Override + public boolean isResponsibleFor(String type) { + return (null == type || "text".equalsIgnoreCase(type)); + } + + @Override + public Map doParse(String oldContent, String newContent, String type) throws IOException { + Map map = new HashMap<>(4); + final String key = "content"; + + ConfigChangeItem cci = new ConfigChangeItem(key, oldContent, newContent); + if (null == oldContent && null != newContent) { + cci.setType(PropertyChangeType.ADDED); + } else if (null != oldContent && null != newContent && !oldContent.equals(newContent)) { + cci.setType(PropertyChangeType.MODIFIED); + } else if (null != oldContent && null == newContent) { + cci.setType(PropertyChangeType.DELETED); + } + map.put(key, cci); + + return map; + } +} + diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java index fa833e9b03..85b61d7390 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java @@ -1,45 +1,44 @@ package com.alibaba.cloud.integration.test.nacos; import com.alibaba.cloud.integration.common.ChaosContainer; +import com.github.dockerjava.api.model.ExposedPort; +import com.github.dockerjava.api.model.HostConfig; +import com.github.dockerjava.api.model.PortBinding; +import com.github.dockerjava.api.model.Ports; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; import java.time.Duration; import java.time.temporal.ChronoUnit; +import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_PORT; -public class NacosContainer> extends ChaosContainer { - - - private static final String NAME = "nacos"; - private static final Integer NACOS_PORT = 8092; - - private static final Integer NACOS_SERVER_PORT = 8848; +public class NacosContainer> extends ChaosContainer { + public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", - ""); + "nacos"); @Override protected void configure() { super.configure(); - this.withNetworkAliases(NAME) - .withExposedPorts(NACOS_PORT) + this.withNetworkAliases(DEFAULT_IMAGE_NAME) + .withExposedPorts(NACOS_SERVER_PORT) .withCreateContainerCmdModifier( createContainerCmd -> { - createContainerCmd.withHostName(NAME); - createContainerCmd.withName(clusterName + "-" + NAME); + createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); + createContainerCmd.withName(clusterName + "-" + DEFAULT_IMAGE_NAME); } ); } public NacosContainer(String clusterName, String image) { super(clusterName, image); - withExposedPorts(NACOS_PORT) - .withCommand("./startup.sh -m standalone") - //定义前置动作 nacos-server是否启动 - .waitingFor(new HttpWaitStrategy() - .forPort(NACOS_SERVER_PORT) - .forStatusCode(200) - .withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS))); + withExposedPorts(NACOS_SERVER_PORT) +// .withCommand("./startup.sh -m standalone") + .withCreateContainerCmdModifier( + cmd -> cmd.withHostConfig( + new HostConfig() + .withPortBindings(new PortBinding(Ports.Binding.bindPort(8849), new ExposedPort(NACOS_SERVER_PORT)))));; } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java new file mode 100644 index 0000000000..42b2dabb55 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java @@ -0,0 +1,159 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed 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. + */ + +package com.alibaba.cloud.integration.test.nacos.common; + +import com.alibaba.cloud.integration.test.nacos.NacosContainer; +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.common.http.Callback; +import com.alibaba.nacos.common.http.HttpClientBeanHolder; +import com.alibaba.nacos.common.http.HttpRestResult; +import com.alibaba.nacos.common.http.client.NacosAsyncRestTemplate; +import com.alibaba.nacos.common.http.param.Header; +import com.alibaba.nacos.common.http.param.Query; +import com.alibaba.nacos.common.model.RestResult; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_URL; + +public class NacosAsyncRestTemplateITCase { + + private NacosAsyncRestTemplate nacosRestTemplate = HttpClientBeanHolder + .getNacosAsyncRestTemplate(LoggerFactory.getLogger(NacosAsyncRestTemplateITCase.class)); + + private NacosContainer nacosContainer; + private static final String image = "nacos/nacos-server:latest"; + + + @Before + public void setUp() throws NacosException { + nacosContainer = new NacosContainer("nacos12133131",image); + nacosContainer.start(); + } + + private class CallbackMap implements Callback { + + private HttpRestResult restResult; + + private Throwable throwable; + + @Override + public void onReceive(RestResult result) { + restResult = (HttpRestResult) result; + } + + @Override + public void onError(Throwable throwable) { + this.throwable = throwable; + } + + @Override + public void onCancel() { + + } + + public HttpRestResult getRestResult() { + return restResult; + } + + public Throwable getThrowable() { + return throwable; + } + } + + @Test + public void test_url_post_form() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test"); + param.put("port", "8080"); + param.put("ip", "11.11.11.11"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + @Test + public void test_url_put_form() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test-change"); + param.put("port", "8080"); + param.put("ip", "11.11.11.11"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + + @Test + public void test_url_get() throws Exception { + String url = NACOS_SERVER_URL + "/instance/list"; + Query query = Query.newInstance().addParam("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.get(url, Header.newInstance(), query, Map.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + Assert.assertEquals(restResult.getData().get("name"), "DEFAULT_GROUP@@app-test"); + } + + @Test + public void test_url_by_map() throws Exception { + String url = NACOS_SERVER_URL + "/instance/list"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.get(url, Header.newInstance(), Query.newInstance().initParams(param), Map.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + Assert.assertEquals(restResult.getData().get("name"), "DEFAULT_GROUP@@app-test"); + } + + @Test + public void test_url_delete() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Query query = Query.newInstance().addParam("ip", "11.11.11.11").addParam("port", "8080") + .addParam("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.delete(url, Header.newInstance(), query, String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java new file mode 100644 index 0000000000..00cb1e2d8c --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java @@ -0,0 +1,48 @@ +package com.alibaba.cloud.integration.test.nacos.core; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; + +import java.net.URL; + +public class HttpClient4Test { + + protected URL baseURL; + + @Autowired + protected TestRestTemplate restTemplate; + + protected ResponseEntity request(String path, MultiValueMap params, Class clazz) { + + HttpHeaders headers = new HttpHeaders(); + + HttpEntity entity = new HttpEntity(headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.baseURL.toString() + path) + .queryParams(params); + + return this.restTemplate.exchange( + builder.toUriString(), HttpMethod.GET, entity, clazz); + } + + protected ResponseEntity request(String path, MultiValueMap params, Class clazz, HttpMethod httpMethod) { + + HttpHeaders headers = new HttpHeaders(); + + HttpEntity entity = new HttpEntity(headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.baseURL.toString() + path) + .queryParams(params); + + return this.restTemplate.exchange( + builder.toUriString(), httpMethod, entity, clazz); + } + +} \ No newline at end of file From 106b11a2f08b5b47c1d918fc6dff2847fe3db2d6 Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 21:09:46 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E6=B7=BB=E5=8A=A0docker=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E4=BB=A5=E5=8F=8A=E6=8E=A8=E9=80=81=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 74 ++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..9f069fb40b --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,74 @@ +# +# 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. +# + +name: Deploy Docker Image + +on: + release: + types: + - published + workflow_dispatch: + +env: + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=30 -DskipTests + +jobs: + deploy-docker-iamge: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + + # setup docker + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # build target with maven + - name: Cache Maven Repos + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: set environment + run: export MAVEN_OPTS=' -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true $MAVEN_OPTS' + - name: Build Project + run: | + ./mvnw -B -Prelease,docker -DskipTests clean install + docker image ls --format "{{.ID}} {{.Repository}} {{.Tag}}" | grep apache| sed 's/apache\//${{ secrets.DOCKERHUB_USERNAME }}\//' |tr A-Z a-z |awk '{system("docker tag "$1" "$2":latest;docker tag "$1" "$2":"$3";")}' + + - name: Push Docker Image + run: | + echo Docker Images: + echo `docker image ls|grep -i ${{ secrets.DOCKERHUB_USERNAME }}|awk '{print $1":"$2}'` + docker image ls|grep -i ${{ secrets.DOCKERHUB_USERNAME }}|awk '{print $1":"$2}'|xargs -i docker push {} From 1c39390c8b9ec7e1415dfa80185a4ea05e5e77d2 Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 21:20:41 +0800 Subject: [PATCH 15/26] fix ci and deploy docker --- .github/workflows/docker.yml | 17 ----------- .github/workflows/integration-test.yml | 39 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9f069fb40b..5ed98b4a0a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,20 +1,3 @@ -# -# 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. -# - name: Deploy Docker Image on: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 0f7404f1cf..b1bab3f0a9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -3,10 +3,49 @@ on: push: branches: - 2021.x + paths: + - '.github/workflows/integration-test.yml' + - '**/pom.xml' + - '**/src/main/**' pull_request: branches: - 2021.x + paths: + - '.github/workflows/integration-test.yml' + - '**/pom.xml' + - '**/src/main/**' jobs: + build-it-image: + name: build-it-image + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v2 + - name: Maven resolve ranges + run: ./mvnw versions:resolve-ranges -ntp -Dincludes='org.springframework:*,org.springframework.boot:*' + - name: Cache Maven Repos + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: shardingsphere-it-cache-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: 8 + - name: Build IT image + run: ./mvnw -B clean install -am -pl spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers -Pit.env.docker -DskipTests -Dspotless.apply.skip=true + - name: Save IT image + run: docker save -o /tmp/spring-cloud-alibaba-testcontainers.tar apache/spring-cloud-alibaba-testcontainers:latest + - name: Upload IT image + uses: actions/upload-artifact@v3 + with: + name: it-image + path: /tmp/spring-cloud-alibaba-testcontainers.tar + retention-days: 1 + integration-testing: name: Integration Testing runs-on: ubuntu-latest From b7465bc3d0c30f511703370beaee32e87c3b2e23 Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 21:31:48 +0800 Subject: [PATCH 16/26] add maven profile and assembly plugin --- .../pom.xml | 48 +++++++++++++++++++ .../assembly/docker-spring-cloud-assembly.xml | 31 ++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index a8c9cc7a06..43ac06c7c2 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -110,6 +110,54 @@ + + it.env.docker + + DOCKER + + + + + maven-assembly-plugin + + false + + src/test/assembly/docker-spring-cloud-assembly.xml + + + + + assembly + + single + + package + + + + + com.spotify + dockerfile-maven-plugin + + apache/spring-cloud-alibaba-testcontainers + ${project.version} + latest + + ${project.build.finalName} + + + + + spring-cloud-alibaba-testcontainers-bin + + build + + + + + + + skipIntegrationTests diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml new file mode 100644 index 0000000000..9866e67eb6 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml @@ -0,0 +1,31 @@ + + spring-cloud-alibaba-testcontainers-bin + + tar.gz + + true + + + + src/test/assembly/bin + bin + 0755 + + + + + + ${project.build.directory}/${project.build.finalName}-tests.jar + lib + 0644 + + + + + + lib + 0644 + + + \ No newline at end of file From 00fa8cfbca96fe6f328d7592bf10a318d8d6fc00 Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 21:33:04 +0800 Subject: [PATCH 17/26] update cache maven repo --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b1bab3f0a9..805e344957 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -27,7 +27,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.m2/repository - key: shardingsphere-it-cache-${{ github.sha }} + key: spring-cloud-alibaba-it-cache-${{ github.sha }} restore-keys: | ${{ runner.os }}-maven- - name: Set up JDK 8 From 223b4b2d3675c5ef0c573582198c3637a600fa3c Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 21:49:13 +0800 Subject: [PATCH 18/26] update maven command --- mvnw | 498 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 280 insertions(+), 218 deletions(-) diff --git a/mvnw b/mvnw index 761189a974..27a2fbd5d1 100755 --- a/mvnw +++ b/mvnw @@ -34,221 +34,283 @@ # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # - # Look for the Apple JDKs first to preserve the existing behaviour, and then look - # for the new JDKs provided by Oracle. - # - if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then - # - # Apple JDKs - # - export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home - fi - - if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then - # - # Apple JDKs - # - export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home - fi - - if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then - # - # Oracle JDKs - # - export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home - fi - - if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then - # - # Apple JDKs - # - export JAVA_HOME=`/usr/libexec/java_home` - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` -fi - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - local basedir=$(pwd) - local wdir=$(pwd) - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - wdir=$(cd "$wdir/.."; pwd) - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -echo "Running version check" -VERSION=$( sed '\!//' -e 's!.*$!!' ) -echo "The found version is [${VERSION}]" - -if echo $VERSION | egrep -q 'M|RC'; then - echo Activating \"milestone\" profile for version=\"$VERSION\" - echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone" -else - echo Deactivating \"milestone\" profile for version=\"$VERSION\" - echo $MAVEN_ARGS | grep -q milestone && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pmilestone//') -fi - -if echo $VERSION | egrep -q 'RELEASE'; then - echo Activating \"central\" profile for version=\"$VERSION\" - echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral" -else - echo Deactivating \"central\" profile for version=\"$VERSION\" - echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//') -fi - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Drevision=${VERSION}" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} ${MAVEN_ARGS} "$@" \ No newline at end of file +iif [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + + fi + + # OS specific support. $var _must_ be set to either true or false. + cygwin=false; + darwin=false; + mingw=false + case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; + esac + + if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi + fi + + if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME + fi + + # For Cygwin, ensure paths are in UNIX format before anything is touched + if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` + fi + + # For Mingw, ensure paths are in UNIX format before anything is touched + if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + fi + + if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi + fi + + if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi + fi + + if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 + fi + + if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." + fi + + CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + + # traverses directory structure from process work directory to filesystem root + # first directory with .mvn subdirectory is considered project base directory + find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" + } + + # concatenates all lines of a file + concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi + } + + BASE_DIR=`find_maven_basedir "$(pwd)"` + if [ -z "$BASE_DIR" ]; then + exit 1; + fi + + ########################################################################################## + # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central + # This allows using the maven wrapper in projects that prohibit checking in binary data. + ########################################################################################## + if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi + fi + ########################################################################################## + # End of extension + ########################################################################################## + + export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} + if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR + fi + MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + + # For Cygwin, switch paths to Windows format before running java + if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` + fi + + # Provide a "standardized" way to retrieve the CLI args that will + # work with both Windows and non-Windows executions. + MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" + export MAVEN_CMD_LINE_ARGS + + WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + + exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" From fb412d62ca2c00efd9cd09de61a221e6587a311a Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 21:50:47 +0800 Subject: [PATCH 19/26] fix Syntax --- mvnw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvnw b/mvnw index 27a2fbd5d1..1f82e25902 100755 --- a/mvnw +++ b/mvnw @@ -34,7 +34,7 @@ # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- -iif [ -z "$MAVEN_SKIP_RC" ] ; then +if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /usr/local/etc/mavenrc ] ; then . /usr/local/etc/mavenrc From 40d3f2e9e5ee5220e07e190193d92900baf00970 Mon Sep 17 00:00:00 2001 From: windwheel Date: Thu, 23 Jun 2022 22:24:29 +0800 Subject: [PATCH 20/26] update version --- .mvn/wrapper/maven-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index a447c9fa81..472e16a5e3 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip \ No newline at end of file +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip \ No newline at end of file From 4fe712ede19553e8bdc2ab90be78d02ac95e9273 Mon Sep 17 00:00:00 2001 From: windwheel Date: Fri, 24 Jun 2022 07:25:07 +0800 Subject: [PATCH 21/26] enhance integration test --- .github/workflows/integration-test.yml | 7 +++++++ build/run_integration_group.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 805e344957..ec9289c7c7 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -68,6 +68,13 @@ jobs: - name: Testing run: mvn clean test # run: mvn clean -Dit.enabled=true test + - name: Download IT image + uses: actions/download-artifact@v3 + with: + name: it-image + path: /tmp/ + - name: Load IT image + run: docker load -i /tmp/spring-cloud-alibaba-testcontainers.tar - name: "run install by skip tests" if: ${{ steps.check_changes.outputs.docs_only != 'true' }} run: mvn -q -B -ntp clean install -DskipTests diff --git a/build/run_integration_group.sh b/build/run_integration_group.sh index 222d643402..634c6055c3 100755 --- a/build/run_integration_group.sh +++ b/build/run_integration_group.sh @@ -30,6 +30,6 @@ mvn_run_integration_test() { set -x # run the integration tests - $RETRY mvn -B -ntp -DredirectTestOutputToFile=true -f spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml -Pmain test "$@" + $RETRY ./mvnw -nsu -B install -f spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml -Pit.env.docker test "$@" ) } From ea9b730931477b65591ee6e3b2af0e541818d902 Mon Sep 17 00:00:00 2001 From: windwheel Date: Sat, 25 Jun 2022 10:03:30 +0800 Subject: [PATCH 22/26] add module && update docker upload repo --- .github/workflows/docker.yml | 14 +++++++++++++- spring-cloud-alibaba-tests/pom.xml | 1 + .../spring-cloud-alibaba-testcontainers/pom.xml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5ed98b4a0a..506a6679cf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,18 @@ name: Deploy Docker Image on: + push: + branches: + - 2021.x + paths: + - '**/pom.xml' + - '**/src/main/**' + pull_request: + branches: + - 2021.x + paths: + - '**/pom.xml' + - '**/src/main/**' release: types: - published @@ -48,7 +60,7 @@ jobs: - name: Build Project run: | ./mvnw -B -Prelease,docker -DskipTests clean install - docker image ls --format "{{.ID}} {{.Repository}} {{.Tag}}" | grep apache| sed 's/apache\//${{ secrets.DOCKERHUB_USERNAME }}\//' |tr A-Z a-z |awk '{system("docker tag "$1" "$2":latest;docker tag "$1" "$2":"$3";")}' + docker image ls --format "{{.ID}} {{.Repository}} {{.Tag}}" | grep alibaba| sed 's/apache\//${{ secrets.DOCKERHUB_USERNAME }}\//' |tr A-Z a-z |awk '{system("docker tag "$1" "$2":latest;docker tag "$1" "$2":"$3";")}' - name: Push Docker Image run: | diff --git a/spring-cloud-alibaba-tests/pom.xml b/spring-cloud-alibaba-tests/pom.xml index 231578d249..20b7034f00 100644 --- a/spring-cloud-alibaba-tests/pom.xml +++ b/spring-cloud-alibaba-tests/pom.xml @@ -14,6 +14,7 @@ spring-cloud-alibaba-test-support + spring-cloud-alibaba-testcontainers diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index 43ac06c7c2..f34c57250e 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -139,7 +139,7 @@ com.spotify dockerfile-maven-plugin - apache/spring-cloud-alibaba-testcontainers + alibaba/spring-cloud-alibaba-testcontainers ${project.version} latest From bbacb01f2699b6716f7dcbdfe71ff39e1189b58e Mon Sep 17 00:00:00 2001 From: windwheel Date: Sat, 25 Jun 2022 10:09:22 +0800 Subject: [PATCH 23/26] remove intergration module and move tests --- .../intergration/nacos-docker-tests/pom.xml | 27 --- .../integration/test/NacosContainer.java | 36 ---- .../integration/test/NacosContainerTest.java | 79 -------- .../intergration/pom.xml | 30 --- .../rocketmq-docker-tests/pom.xml | 19 -- .../integration/test/RocketmqContainer.java | 173 ------------------ .../test/RocketmqDebeziumSourceTests.java | 4 - .../pom.xml | 10 - .../test/nacos/NacosContainer.java | 13 +- .../test/nacos/NacosContainerTest.java | 2 +- .../common/NacosAsyncRestTemplateITCase.java | 9 +- 11 files changed, 15 insertions(+), 387 deletions(-) delete mode 100644 spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml delete mode 100644 spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java delete mode 100644 spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java delete mode 100644 spring-cloud-alibaba-tests/intergration/pom.xml delete mode 100644 spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml delete mode 100644 spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java delete mode 100644 spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml deleted file mode 100644 index b382c18ec0..0000000000 --- a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - intergration - com.alibaba.cloud - 2021.0.1.1-SNAPSHOT - - 4.0.0 - - nacos-docker-tests - - - com.alibaba.cloud - spring-cloud-alibaba-testcontainers - 2021.0.1.1-SNAPSHOT - test - - - - - 8 - 8 - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java deleted file mode 100644 index 3d827612ff..0000000000 --- a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainer.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.alibaba.cloud.integration.test; - -import java.time.Duration; -import java.time.temporal.ChronoUnit; - -import com.alibaba.cloud.integration.common.ChaosContainer; -import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; - -import static com.alibaba.cloud.integration.common.nacos.Const.DEFAULT_IMAGE_NAME; -import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_PORT; - - -public class NacosContainer> extends ChaosContainer { - - @Override - protected void configure() { - super.configure(); - this.withNetworkAliases(DEFAULT_IMAGE_NAME) - .withExposedPorts(NACOS_SERVER_PORT) - .withCreateContainerCmdModifier( createContainerCmd -> { - createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); - createContainerCmd.withName(clusterName + "-" + DEFAULT_IMAGE_NAME); - } ); - - } - - public NacosContainer(String clusterName, String image) { - super(clusterName, image); - withExposedPorts(NACOS_SERVER_PORT) - .withCommand("./startup.sh -m standalone"); - } - - - - -} diff --git a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java b/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java deleted file mode 100644 index a2eac63fb8..0000000000 --- a/spring-cloud-alibaba-tests/intergration/nacos-docker-tests/src/test/java/com/alibaba/cloud/integration/test/NacosContainerTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.alibaba.cloud.integration.test; - -import com.alibaba.cloud.integration.NacosConfig; -import com.alibaba.cloud.integration.UserProperties; -import com.alibaba.cloud.integration.common.NacosBootTester; -import com.alibaba.cloud.nacos.NacosConfigProperties; -import com.alibaba.nacos.api.exception.NacosException; -import lombok.extern.slf4j.Slf4j; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import static com.alibaba.cloud.integration.common.nacos.Const.DEFAULT_IMAGE_NAME; - -@Slf4j -public class NacosContainerTest extends NacosBootTester { - - private NacosContainer nacosContainer; - private static final String image = "freemanlau/nacos:1.4.2"; - - @Override - public void vaildateUpdateState(NacosConfig nacosConfig, NacosConfigProperties properties, UserProperties userProperties) throws NacosException { - super.vaildateUpdateState(nacosConfig, properties, userProperties); - } - - @Override - protected String uploadFile(UserProperties userProperties) { - - try{ - - - String content = - "configdata:\n" + - " user:\n" + - " age: 22\n" + - " name: freeman1123\n" + - " map:\n" + - " hobbies:\n" + - " - art\n" + - " - programming\n" + - " - movie\n" + - " intro: Hello, I'm freeman\n" + - " extra: yo~\n" + - " users:\n" + - " - name: dad\n" + - " age: 20\n" + - " - name: mom\n" + - " age: 18"; - return content; - }catch (Exception ex){ - log.error("Nacos pulish failed"); - return null; - } - } - - - - @Before - public void setUp() throws Exception{ - nacosContainer = new NacosContainer(DEFAULT_IMAGE_NAME,image); - nacosContainer.start(); - } - - @After - public void cleanup() throws Exception{ - - } - - @Test - public void testNacosStartUp() throws Exception{ - NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); - UserProperties userProperties = new UserProperties(); - NacosConfig nacosConfig = NacosConfig.builder(). - build(); - vaildateUpdateState(nacosConfig,nacosConfigProperties,userProperties); - } - - -} diff --git a/spring-cloud-alibaba-tests/intergration/pom.xml b/spring-cloud-alibaba-tests/intergration/pom.xml deleted file mode 100644 index 81b53156b7..0000000000 --- a/spring-cloud-alibaba-tests/intergration/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - spring-cloud-alibaba-tests - com.alibaba.cloud - 2021.0.1.1-SNAPSHOT - - 4.0.0 - - intergration - pom - - - 8 - 8 - - - - - - com.alibaba.cloud - spring-cloud-alibaba-testcontainers - 2021.0.1.1-SNAPSHOT - test - - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml deleted file mode 100644 index 364357aee8..0000000000 --- a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - intergration - com.alibaba.cloud - 2021.0.1.1-SNAPSHOT - - 4.0.0 - - rocketmq-docker-tests - - - 8 - 8 - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java deleted file mode 100644 index 1a447b7a48..0000000000 --- a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqContainer.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.alibaba.cloud.integration.test; - -import java.time.Duration; -import java.util.Objects; -import java.util.UUID; - -import com.alibaba.cloud.integration.common.ChaosContainer; -import com.alibaba.cloud.integration.utils.DockerUtils; -import lombok.extern.slf4j.Slf4j; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; -import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; - -import static java.time.temporal.ChronoUnit.SECONDS; - -@Slf4j -public abstract class RocketmqContainer> extends ChaosContainer { - - public static final int INVALID_PORT = -1; - public static final int ZK_PORT = 2181; - public static final int CS_PORT = 2184; - public static final int BOOKIE_PORT = 3181; - public static final int BROKER_PORT = 6650; - public static final int BROKER_HTTP_PORT = 8080; - - public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", - ""); - - public static final boolean CONTAINERS_LEAVE_RUNNING = - Boolean.parseBoolean(System.getenv("CONTAINERS_LEAVE_RUNNING")); - - - private final String hostname; - private final String serviceName; - private final String serviceEntryPoint; - private final int servicePort; - private final int httpPort; - private final String httpPath; - - public RocketmqContainer(String clusterName, - String hostname, - String serviceName, - String serviceEntryPoint, - int servicePort, - int httpPort) { - this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, "/metrics"); - } - - - public RocketmqContainer(String clusterName, - String hostname, - String serviceName, - String serviceEntryPoint, - int servicePort, - int httpPort, - String httpPath) { - this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, httpPath, - DEFAULT_IMAGE_NAME); - } - - public RocketmqContainer(String clusterName, - String hostname, - String serviceName, - String serviceEntryPoint, - int servicePort, - int httpPort, - String httpPath, - String pulsarImageName) { - super(clusterName, pulsarImageName); - this.hostname = hostname; - this.serviceName = serviceName; - this.serviceEntryPoint = serviceEntryPoint; - this.servicePort = servicePort; - this.httpPort = httpPort; - this.httpPath = httpPath; - - configureLeaveContainerRunning(this); - } - - public static void configureLeaveContainerRunning( - GenericContainer container) { - if (CONTAINERS_LEAVE_RUNNING) { - // use Testcontainers reuse containers feature to leave the container running - container.withReuse(true); - // add label that can be used to find containers that are left running. - container.withLabel("markcontainer", "true"); - // add a random label to prevent reuse of containers - container.withLabel("markcontainer.random", UUID.randomUUID().toString()); - } - } - - @Override - protected void beforeStop() { - super.beforeStop(); - if (null != getContainerId()) { - DockerUtils.dumpContainerDirToTargetCompressed( - getDockerClient(), - getContainerId(), - "/var/log/pulsar" - ); - } - } - - @Override - public void stop() { - if (CONTAINERS_LEAVE_RUNNING) { - log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); - return; - } - super.stop(); - } - - @Override - public String getContainerName() { - return clusterName + "-" + hostname; - } - - @Override - protected void configure() { - super.configure(); - if (httpPort > 0) { - addExposedPorts(httpPort); - } - if (servicePort > 0) { - addExposedPort(servicePort); - } - } - - protected void beforeStart() {} - - protected void afterStart() {} - - @Override - public void start() { - if (httpPort > 0 && servicePort < 0) { - this.waitStrategy = new HttpWaitStrategy() - .forPort(httpPort) - .forStatusCode(200) - .forPath(httpPath) - .withStartupTimeout(Duration.of(300, SECONDS)); - } else if (httpPort > 0 || servicePort > 0) { - this.waitStrategy = new HostPortWaitStrategy() - .withStartupTimeout(Duration.of(300, SECONDS)); - } - this.withCreateContainerCmdModifier(createContainerCmd -> { - createContainerCmd.withHostName(hostname); - createContainerCmd.withName(getContainerName()); - createContainerCmd.withEntrypoint(serviceEntryPoint); - }); - - beforeStart(); - super.start(); - afterStart(); - log.info("[{}] Start pulsar service {} at container {}", getContainerName(), serviceName, getContainerId()); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof RocketmqContainer)) { - return false; - } - - RocketmqContainer another = (RocketmqContainer) o; - return getContainerId().equals(another.getContainerId()) - && super.equals(another); - } - - @Override - public int hashCode() { - return 31 * super.hashCode() + Objects.hash( - getContainerId()); - } -} diff --git a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java b/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java deleted file mode 100644 index 29a2a4a403..0000000000 --- a/spring-cloud-alibaba-tests/intergration/rocketmq-docker-tests/src/test/java/com/alibaba/cloud/integration/test/RocketmqDebeziumSourceTests.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.alibaba.cloud.integration.test; - -public class RocketmqDebeziumSourceTests { -} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index f34c57250e..21d8851da2 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -167,16 +167,6 @@ - - main - - true - - - ../intergration/nacos-docker-tests - ../intergration/rocketmq-docker-tests - - diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java index 85b61d7390..613a70a2b6 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java @@ -11,6 +11,7 @@ import java.time.temporal.ChronoUnit; import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_PORT; +import static java.lang.String.format; public class NacosContainer> extends ChaosContainer { @@ -33,12 +34,12 @@ protected void configure() { public NacosContainer(String clusterName, String image) { super(clusterName, image); - withExposedPorts(NACOS_SERVER_PORT) -// .withCommand("./startup.sh -m standalone") - .withCreateContainerCmdModifier( - cmd -> cmd.withHostConfig( - new HostConfig() - .withPortBindings(new PortBinding(Ports.Binding.bindPort(8849), new ExposedPort(NACOS_SERVER_PORT)))));; + withExposedPorts(NACOS_SERVER_PORT) + .withCommand(format("/bin/bash -c ' cmd.withHostConfig( +// new HostConfig() +// .withPortBindings(new PortBinding(Ports.Binding.bindPort(8849), new ExposedPort(NACOS_SERVER_PORT)))));; } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java index a3b4b27be8..a8235f0124 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java @@ -62,7 +62,7 @@ protected String uploadFile(UserProperties userProperties) { @Before public void setUp() throws Exception{ - nacosContainer = new NacosContainer("nacos12133131",image); + nacosContainer = new NacosContainer("nacos-example",image); nacosContainer.start(); } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java index 42b2dabb55..52c1629dc8 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java @@ -30,8 +30,12 @@ import org.junit.Test; import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.nio.file.WatchKey; +import java.nio.file.WatchService; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_URL; @@ -46,7 +50,7 @@ public class NacosAsyncRestTemplateITCase { @Before public void setUp() throws NacosException { - nacosContainer = new NacosContainer("nacos12133131",image); + nacosContainer = new NacosContainer("nacos-example",image); nacosContainer.start(); } @@ -82,11 +86,12 @@ public Throwable getThrowable() { @Test public void test_url_post_form() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; Map param = new HashMap<>(); param.put("serviceName", "app-test"); param.put("port", "8080"); - param.put("ip", "11.11.11.11"); + param.put("ip", "127.0.0.1"); CallbackMap callbackMap = new CallbackMap<>(); nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, String.class, callbackMap); Thread.sleep(2000); From 3555b45ec220df645e9f09394424c14b2f3d4117 Mon Sep 17 00:00:00 2001 From: windwheel Date: Sun, 26 Jun 2022 16:09:24 +0800 Subject: [PATCH 24/26] fix checkstyle && add assembly --- build/run_integration_group.sh | 1 + .../cloud/testsupport/ContainerStarter.java | 4 + .../com/alibaba/cloud/testsupport/Tester.java | 1 - .../assembly/docker-spring-cloud-assembly.xml | 31 + .../pom.xml | 4 +- .../cloud/integration/NacosConfig.java | 22 +- .../cloud/integration/UserProperties.java | 28 +- .../integration/common/ChaosContainer.java | 162 ++-- .../cloud/integration/common/KeyValue.java | 208 +++-- .../integration/common/NacosBootTester.java | 41 +- .../common/RocketmqSourceTester.java | 296 ++++--- .../cloud/integration/common/Schema.java | 155 ++-- .../cloud/integration/common/nacos/Const.java | 19 +- .../integration/common/nacos/Params.java | 34 +- .../common/nacos/TextChangeParser.java | 46 +- .../docker/ContainerExecException.java | 28 +- .../docker/ContainerExecResult.java | 41 +- .../docker/ContainerExecResultBytes.java | 13 +- .../cloud/integration/utils/DockerUtils.java | 771 +++++++++--------- .../assembly/docker-spring-cloud-assembly.xml | 2 +- .../test/nacos/NacosContainer.java | 70 +- .../test/nacos/NacosContainerTest.java | 116 ++- .../common/NacosAsyncRestTemplateITCase.java | 241 +++--- .../test/nacos/core/HttpClient4Test.java | 63 +- .../test/rocketmq/RocketmqContainer.java | 299 ++++--- 25 files changed, 1323 insertions(+), 1373 deletions(-) create mode 100644 spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/assembly/docker-spring-cloud-assembly.xml diff --git a/build/run_integration_group.sh b/build/run_integration_group.sh index 634c6055c3..66ecfefd7e 100755 --- a/build/run_integration_group.sh +++ b/build/run_integration_group.sh @@ -29,6 +29,7 @@ mvn_run_integration_test() { fi set -x + # run the integration tests $RETRY ./mvnw -nsu -B install -f spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml -Pit.env.docker test "$@" ) diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/ContainerStarter.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/ContainerStarter.java index febcc3832e..7b1793232f 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/ContainerStarter.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/ContainerStarter.java @@ -49,6 +49,7 @@ public class ContainerStarter { /** * Start Nacos container, using default version. + * @return a generic container */ public static GenericContainer startNacos() { return startNacos(NACOS_VERSION); @@ -56,6 +57,7 @@ public static GenericContainer startNacos() { /** * Start RocketMQ container, using default version. + * @return a generic container */ public static GenericContainer startRocketmq() { return startRocketmq(ROCKETMQ_VERSION); @@ -64,6 +66,7 @@ public static GenericContainer startRocketmq() { /** * Start Nacos container, using specific version. * @param version Nacos version + * @return a generic container */ public static GenericContainer startNacos(String version) { if (!nacosMap.containsKey(version)) { @@ -80,6 +83,7 @@ public static GenericContainer startNacos(String version) { /** * Start RocketMQ container, using specific version. * @param version RocketMQ version + * @return a generic container */ public static GenericContainer startRocketmq(String version) { if (!rocketmqMap.containsKey(version)) { diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/Tester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/Tester.java index 4ca82655c9..dc4db28829 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/Tester.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-test-support/src/main/java/com/alibaba/cloud/testsupport/Tester.java @@ -19,7 +19,6 @@ /** * * @author freeman - * @date 2021.0.1.0 */ public class Tester { diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/assembly/docker-spring-cloud-assembly.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/assembly/docker-spring-cloud-assembly.xml new file mode 100644 index 0000000000..326e8c05d5 --- /dev/null +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/assembly/docker-spring-cloud-assembly.xml @@ -0,0 +1,31 @@ + + spring-cloud-alibaba-testcontainers-bin + + tar.gz + + true + + + + src/test/assembly/bin + bin + 0755 + + + + + + ${project.build.directory}/${project.build.finalName}-tests.jar + lib + 0644 + + + + + + lib + 0644 + + + \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index 21d8851da2..90090a2211 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -165,7 +165,7 @@ skipIntegrationTests - + diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java index 35933aef3b..ba9470c138 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java @@ -3,16 +3,14 @@ import lombok.Builder; import lombok.Getter; -@Builder -@Getter -public class NacosConfig { - - private String dataId; - - private String namespace; - - private String group; - - private String type; - +@Builder @Getter public class NacosConfig { + + private String dataId; + + private String namespace; + + private String group; + + private String type; + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java index 1e025b78d6..752b452346 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java @@ -16,29 +16,23 @@ package com.alibaba.cloud.integration; -import java.util.List; -import java.util.Map; - import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; +import java.util.List; +import java.util.Map; /** - * - * * @author freeman */ -@Data -public class UserProperties { - private String name; - private Integer age; - private Map map; - private List users; - - @Data - public static class User { +@Data public class UserProperties { private String name; private Integer age; - } - + private Map map; + private List users; + + @Data public static class User { + private String name; + private Integer age; + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java index e946042ed5..c68bd555d7 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java @@ -10,89 +10,85 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; -@Slf4j -public class ChaosContainer> extends GenericContainer { - - protected final String clusterName; - - protected ChaosContainer(String clusterName, String image) { - super(image); - this.clusterName = clusterName; - } - - @Override - protected void configure() { - super.configure(); - addEnv("MALLOC_ARENA_MAX", "1"); - } - - protected void beforeStop() { - if (null == getContainerId()) { - return; +@Slf4j public class ChaosContainer> + extends GenericContainer { + + protected final String clusterName; + + protected ChaosContainer(String clusterName, String image) { + super(image); + this.clusterName = clusterName; } - - // dump the container log - DockerUtils.dumpContainerLogToTarget( - getDockerClient(), - getContainerId() - ); - } - - @Override - public void stop() { - beforeStop(); - super.stop(); - } - - protected void tailContainerLog() { - withLogConsumer(item -> log.info(item.getUtf8String())); - } - - public void putFile(String path, byte[] contents) throws Exception { - String base64contents = Base64.getEncoder().encodeToString(contents); - String cmd = String.format("echo %s | base64 -d > %s", base64contents, path); - execCmd("bash", "-c", cmd); - } - - public ContainerExecResult execCmd(String... commands) throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommand(client, dockerId, commands); - } - - public CompletableFuture execCmdAsync(String... commands) throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommandAsync(client, dockerId, commands); - } - - public ContainerExecResult execCmdAsUser(String userId, String... commands) throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommandAsUser(userId, client, dockerId, commands); - } - - public CompletableFuture execCmdAsyncAsUser(String userId, String... commands) throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommandAsyncAsUser(userId, client, dockerId, commands); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ChaosContainer)) { - return false; + + @Override protected void configure() { + super.configure(); + addEnv("MALLOC_ARENA_MAX", "1"); } - - ChaosContainer another = (ChaosContainer) o; - return clusterName.equals(another.clusterName) - && super.equals(another); - } - - @Override - public int hashCode() { - return 31 * super.hashCode() + Objects.hash( - clusterName); - } - + + protected void beforeStop() { + if (null == getContainerId()) { + return; + } + + // dump the container log + DockerUtils.dumpContainerLogToTarget(getDockerClient(), getContainerId()); + } + + @Override public void stop() { + beforeStop(); + super.stop(); + } + + protected void tailContainerLog() { + withLogConsumer(item -> log.info(item.getUtf8String())); + } + + public void putFile(String path, byte[] contents) throws Exception { + String base64contents = Base64.getEncoder().encodeToString(contents); + String cmd = String.format("echo %s | base64 -d > %s", base64contents, + path); + execCmd("bash", "-c", cmd); + } + + public ContainerExecResult execCmd(String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommand(client, dockerId, commands); + } + + public CompletableFuture execCmdAsync(String... commands) + throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsync(client, dockerId, commands); + } + + public ContainerExecResult execCmdAsUser(String userId, String... commands) + throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsUser(userId, client, dockerId, commands); + } + + public CompletableFuture execCmdAsyncAsUser(String userId, + String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsyncAsUser(userId, client, dockerId, + commands); + } + + @Override public boolean equals(Object o) { + if (!(o instanceof ChaosContainer)) { + return false; + } + + ChaosContainer another = (ChaosContainer) o; + return clusterName.equals(another.clusterName) && super.equals(another); + } + + @Override public int hashCode() { + return 31 * super.hashCode() + Objects.hash(clusterName); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java index af868c7247..426956bca0 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java @@ -4,119 +4,113 @@ import java.util.Objects; public class KeyValue { - private final K key; - private final V value; - - public KeyValue(K key, V value) { - this.key = key; - this.value = value; - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - @Override - public int hashCode() { - return Objects.hash(key, value); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof KeyValue)) { - return false; + private final K key; + private final V value; + + public KeyValue(K key, V value) { + this.key = key; + this.value = value; } - KeyValue another = (KeyValue) obj; - return Objects.equals(key, another.key) - && Objects.equals(value, another.value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("(key = \"") - .append(key) - .append("\", value = \"") - .append(value) - .append("\")"); - return sb.toString(); - } - - /** - * Decoder to decode key/value bytes. - */ - @FunctionalInterface - public interface KeyValueDecoder { - + /** - * Decode key and value bytes into a {@link KeyValue} pair. + * Encode a key and value pair into a bytes array. * - * @param keyData key data - * @param valueData value data - * @return the decoded {@link KeyValue} pair + * @param key key object to encode + * @param keyWriter a writer to encode key object + * @param value value object to encode + * @param valueWriter a writer to encode value object + * @return the encoded bytes array */ - KeyValue decode(byte[] keyData, byte[] valueData); - - } - - /** - * Encode a key and value pair into a bytes array. - * - * @param key key object to encode - * @param keyWriter a writer to encode key object - * @param value value object to encode - * @param valueWriter a writer to encode value object - * @return the encoded bytes array - */ - public static byte[] encode(K key, Schema keyWriter, - V value, Schema valueWriter) { - byte [] keyBytes; - if (key == null) { - keyBytes = new byte[0]; - } else { - keyBytes = keyWriter.encode(key); + public static byte[] encode(K key, Schema keyWriter, V value, + Schema valueWriter) { + byte[] keyBytes; + if (key == null) { + keyBytes = new byte[0]; + } + else { + keyBytes = keyWriter.encode(key); + } + + byte[] valueBytes; + if (value == null) { + valueBytes = new byte[0]; + } + else { + valueBytes = valueWriter.encode(value); + } + ByteBuffer byteBuffer = ByteBuffer.allocate( + 4 + keyBytes.length + 4 + valueBytes.length); + byteBuffer.putInt(key == null ? -1 : keyBytes.length).put(keyBytes) + .putInt(value == null ? -1 : valueBytes.length).put(valueBytes); + return byteBuffer.array(); } - - byte [] valueBytes; - if (value == null) { - valueBytes = new byte[0]; - } else { - valueBytes = valueWriter.encode(value); + + /** + * Decode the value into a key/value pair. + * + * @param data the encoded bytes + * @param decoder the decoder to decode encoded key/value bytes + * @return the decoded key/value pair + */ + public static KeyValue decode(byte[] data, + KeyValueDecoder decoder) { + ByteBuffer byteBuffer = ByteBuffer.wrap(data); + int keyLength = byteBuffer.getInt(); + byte[] keyBytes = keyLength == -1 ? null : new byte[keyLength]; + if (keyBytes != null) { + byteBuffer.get(keyBytes); + } + + int valueLength = byteBuffer.getInt(); + byte[] valueBytes = valueLength == -1 ? null : new byte[valueLength]; + if (valueBytes != null) { + byteBuffer.get(valueBytes); + } + + return decoder.decode(keyBytes, valueBytes); } - ByteBuffer byteBuffer = ByteBuffer.allocate(4 + keyBytes.length + 4 + valueBytes.length); - byteBuffer - .putInt(key == null ? -1 : keyBytes.length) - .put(keyBytes) - .putInt(value == null ? -1 : valueBytes.length) - .put(valueBytes); - return byteBuffer.array(); - } - - /** - * Decode the value into a key/value pair. - * - * @param data the encoded bytes - * @param decoder the decoder to decode encoded key/value bytes - * @return the decoded key/value pair - */ - public static KeyValue decode(byte[] data, KeyValueDecoder decoder) { - ByteBuffer byteBuffer = ByteBuffer.wrap(data); - int keyLength = byteBuffer.getInt(); - byte[] keyBytes = keyLength == -1 ? null : new byte[keyLength]; - if (keyBytes != null) { - byteBuffer.get(keyBytes); + + public K getKey() { + return key; } - - int valueLength = byteBuffer.getInt(); - byte[] valueBytes = valueLength == -1 ? null : new byte[valueLength]; - if (valueBytes != null) { - byteBuffer.get(valueBytes); + + public V getValue() { + return value; + } + + @Override public int hashCode() { + return Objects.hash(key, value); + } + + @Override public boolean equals(Object obj) { + if (!(obj instanceof KeyValue)) { + return false; + } + KeyValue another = (KeyValue) obj; + return Objects.equals(key, another.key) && Objects.equals(value, + another.value); + } + + @Override public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("(key = \"").append(key).append("\", value = \"").append(value) + .append("\")"); + return sb.toString(); + } + + /** + * Decoder to decode key/value bytes. + */ + @FunctionalInterface public interface KeyValueDecoder { + + /** + * Decode key and value bytes into a {@link KeyValue} pair. + * + * @param keyData key data + * @param valueData value data + * @return the decoded {@link KeyValue} pair + */ + KeyValue decode(byte[] keyData, byte[] valueData); + } - - return decoder.decode(keyBytes, valueBytes); - } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java index addb0b7910..3131a8c4f6 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java @@ -11,23 +11,28 @@ import org.testcontainers.containers.GenericContainer; public abstract class NacosBootTester { - - private Logger logger = LoggerFactory.getLogger(NacosBootTester.class); - - public void vaildateUpdateState(NacosConfig nacosConfig, NacosConfigProperties properties, UserProperties userProperties) throws NacosException { - - ConfigService configService = NacosConfigManager.createConfigService(properties); - String content = uploadFile(userProperties); - try{ - configService.publishConfig(nacosConfig.getDataId(),nacosConfig.getGroup(),content,nacosConfig.getType()); - }finally { - logger.info("nacos 配置文件已经上传完成"); + + private final Logger logger = LoggerFactory.getLogger(NacosBootTester.class); + + public void vaildateUpdateState(NacosConfig nacosConfig, + NacosConfigProperties properties, UserProperties userProperties) + throws NacosException { + + ConfigService configService = NacosConfigManager.createConfigService( + properties); + String content = uploadFile(userProperties); + try { + configService.publishConfig(nacosConfig.getDataId(), + nacosConfig.getGroup(), content, nacosConfig.getType()); + } + finally { + logger.info("nacos 配置文件已经上传完成"); + } } - } - - /** - * nacos update yaml - */ - protected abstract String uploadFile(UserProperties userProperties); - + + /** + * nacos update yaml + */ + protected abstract String uploadFile(UserProperties userProperties); + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java index 43178e0fd6..9b09b2933a 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java @@ -2,163 +2,161 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import org.junit.Assert; import org.testcontainers.containers.GenericContainer; import org.testcontainers.shaded.com.google.common.collect.Maps; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -@Getter -@Slf4j -public abstract class RocketmqSourceTester { - - public static final String INSERT = "INSERT"; - - public static final String DELETE = "DELETE"; - - public static final String UPDATE = "UPDATE"; - - protected final String sourceType; - protected final Map sourceConfig; - - protected int numEntriesToInsert = 1; - protected int numEntriesExpectAfterStart = 9; - - public static final Set DEBEZIUM_FIELD_SET = new HashSet() {{ - add("before"); - add("after"); - add("source"); - add("op"); - add("ts_ms"); - add("transaction"); - }}; - - protected RocketmqSourceTester(String sourceType) { - this.sourceType = sourceType; - this.sourceConfig = Maps.newHashMap(); - } - - public abstract void setServiceContainer(ServiceContainerT serviceContainer); - - public String sourceType() { - return sourceType; - } - - public Map sourceConfig() { - return sourceConfig; - } - - public abstract void prepareSource() throws Exception; - - public abstract void prepareInsertEvent() throws Exception; - - public abstract void prepareDeleteEvent() throws Exception; - - public abstract void prepareUpdateEvent() throws Exception; - - public abstract Map produceSourceMessages(int numMessages) throws Exception; - - public void validateSourceResult(Consumer consumer, int number, - String eventType, String converterClassName) throws Exception { - doPreValidationCheck(eventType); - if (converterClassName.endsWith("AvroConverter")) { - validateSourceResultAvro(consumer, number, eventType); - } else { - validateSourceResultJson(consumer, number, eventType); +@Getter @Slf4j public abstract class RocketmqSourceTester { + + public static final String INSERT = "INSERT"; + + public static final String DELETE = "DELETE"; + + public static final String UPDATE = "UPDATE"; + public static final Set DEBEZIUM_FIELD_SET = new HashSet() {{ + add("before"); + add("after"); + add("source"); + add("op"); + add("ts_ms"); + add("transaction"); + }}; + protected final String sourceType; + protected final Map sourceConfig; + protected int numEntriesToInsert = 1; + protected int numEntriesExpectAfterStart = 9; + + protected RocketmqSourceTester(String sourceType) { + this.sourceType = sourceType; + this.sourceConfig = Maps.newHashMap(); } - doPostValidationCheck(eventType); - } - - /** - * Execute before regular validation to check database-specific state. - */ - public void doPreValidationCheck(String eventType) { - log.info("pre-validation of {}", eventType); - } - - /** - * Execute after regular validation to check database-specific state. - */ - public void doPostValidationCheck(String eventType) { - log.info("post-validation of {}", eventType); - } - - public void validateSourceResultJson(Consumer> consumer, int number, String eventType) throws Exception { - int recordsNumber = 0; -// Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); -// while(msg != null) { -// recordsNumber ++; -// final String key = new String(msg.getValue().getKey()); -// final String value = new String(msg.getValue().getValue()); -// log.info("Received message: key = {}, value = {}.", key, value); -// Assert.assertTrue(key.contains(this.keyContains())); -// Assert.assertTrue(value.contains(this.valueContains())); -// if (eventType != null) { -// Assert.assertTrue(value.contains(this.eventContains(eventType, true))); -// } -// consumer.acknowledge(msg); -// msg = consumer.receive(1, TimeUnit.SECONDS); -// } -// -// Assert.assertEquals(recordsNumber, number); -// log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); - } - - public void validateSourceResultAvro(Consumer> consumer, - int number, String eventType) throws Exception { - int recordsNumber = 0; -// Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); -// while(msg != null) { -// recordsNumber ++; -// K keyRecord = msg.getValue().getKey(); -// Assert.assertNotNull(keyRecord.getFields()); -// Assert.assertTrue(keyRecord.getFields().size() > 0); -// -// V valueRecord = msg.getValue().getValue(); -// Assert.assertNotNull(valueRecord.getFields()); -// Assert.assertTrue(valueRecord.getFields().size() > 0); -// -// log.info("Received message: key = {}, value = {}.", keyRecord.getNativeObject(), valueRecord.getNativeObject()); -// for (Field field : valueRecord.getFields()) { -// log.info("validating field {}", field.getName()); -// Assert.assertTrue(DEBEZIUM_FIELD_SET.contains(field.getName())); -// } -// -// if (eventType != null) { -// String op = valueRecord.getField("op").toString(); -// Assert.assertEquals(this.eventContains(eventType, false), op); -// } -// consumer.acknowledge(msg); -// msg = consumer.receive(1, TimeUnit.SECONDS); -// } -// -// Assert.assertEquals(recordsNumber, number); -// log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); - } - - public int initialDelayForMsgReceive() { - return 2; - } - - public String keyContains() { - return "dbserver1.inventory.products.Key"; - } - - public String valueContains() { - return "dbserver1.inventory.products.Value"; - } - - public String eventContains(String eventType, boolean isJson) { - if (eventType.equals(INSERT)) { - return isJson ? "\"op\":\"c\"" : "c"; - } else if (eventType.equals(UPDATE)) { - return isJson ? "\"op\":\"u\"" : "u"; - } else { - return isJson ? "\"op\":\"d\"" : "d"; + + public abstract void setServiceContainer(ServiceContainerT serviceContainer); + + public String sourceType() { + return sourceType; + } + + public Map sourceConfig() { + return sourceConfig; + } + + public abstract void prepareSource() throws Exception; + + public abstract void prepareInsertEvent() throws Exception; + + public abstract void prepareDeleteEvent() throws Exception; + + public abstract void prepareUpdateEvent() throws Exception; + + public abstract Map produceSourceMessages(int numMessages) + throws Exception; + + public void validateSourceResult(Consumer consumer, int number, String eventType, + String converterClassName) throws Exception { + doPreValidationCheck(eventType); + if (converterClassName.endsWith("AvroConverter")) { + validateSourceResultAvro(consumer, number, eventType); + } + else { + validateSourceResultJson(consumer, number, eventType); + } + doPostValidationCheck(eventType); + } + + /** + * Execute before regular validation to check database-specific state. + */ + public void doPreValidationCheck(String eventType) { + log.info("pre-validation of {}", eventType); + } + + /** + * Execute after regular validation to check database-specific state. + */ + public void doPostValidationCheck(String eventType) { + log.info("post-validation of {}", eventType); + } + + public void validateSourceResultJson(Consumer> consumer, + int number, String eventType) throws Exception { + int recordsNumber = 0; + // Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); + // while(msg != null) { + // recordsNumber ++; + // final String key = new String(msg.getValue().getKey()); + // final String value = new String(msg.getValue().getValue()); + // log.info("Received message: key = {}, value = {}.", key, value); + // Assert.assertTrue(key.contains(this.keyContains())); + // Assert.assertTrue(value.contains(this.valueContains())); + // if (eventType != null) { + // Assert.assertTrue(value.contains(this.eventContains(eventType, true))); + // } + // consumer.acknowledge(msg); + // msg = consumer.receive(1, TimeUnit.SECONDS); + // } + // + // Assert.assertEquals(recordsNumber, number); + // log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); + } + + public void validateSourceResultAvro(Consumer> consumer, + int number, String eventType) throws Exception { + int recordsNumber = 0; + // Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); + // while(msg != null) { + // recordsNumber ++; + // K keyRecord = msg.getValue().getKey(); + // Assert.assertNotNull(keyRecord.getFields()); + // Assert.assertTrue(keyRecord.getFields().size() > 0); + // + // V valueRecord = msg.getValue().getValue(); + // Assert.assertNotNull(valueRecord.getFields()); + // Assert.assertTrue(valueRecord.getFields().size() > 0); + // + // log.info("Received message: key = {}, value = {}.", keyRecord.getNativeObject(), valueRecord.getNativeObject()); + // for (Field field : valueRecord.getFields()) { + // log.info("validating field {}", field.getName()); + // Assert.assertTrue(DEBEZIUM_FIELD_SET.contains(field.getName())); + // } + // + // if (eventType != null) { + // String op = valueRecord.getField("op").toString(); + // Assert.assertEquals(this.eventContains(eventType, false), op); + // } + // consumer.acknowledge(msg); + // msg = consumer.receive(1, TimeUnit.SECONDS); + // } + // + // Assert.assertEquals(recordsNumber, number); + // log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); + } + + public int initialDelayForMsgReceive() { + return 2; + } + + public String keyContains() { + return "dbserver1.inventory.products.Key"; + } + + public String valueContains() { + return "dbserver1.inventory.products.Value"; + } + + public String eventContains(String eventType, boolean isJson) { + if (eventType.equals(INSERT)) { + return isJson ? "\"op\":\"c\"" : "c"; + } + else if (eventType.equals(UPDATE)) { + return isJson ? "\"op\":\"u\"" : "u"; + } + else { + return isJson ? "\"op\":\"d\"" : "d"; + } } - } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java index cd6000982f..8bd79527e9 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java @@ -6,9 +6,9 @@ * 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 - * + *

+ * 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 @@ -18,90 +18,73 @@ */ package com.alibaba.cloud.integration.common; -import java.nio.ByteBuffer; -import java.sql.Time; -import java.sql.Timestamp; -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.Date; -import java.util.Optional; - - /** * Message schema definition. */ -public interface Schema extends Cloneable{ - - /** - * Check if the message is a valid object for this schema. - * - *

The implementation can choose what its most efficient approach to validate the schema. - * If the implementation doesn't provide it, it will attempt to use {@link #decode(byte[])} - * to see if this schema can decode this message or not as a validation mechanism to verify - * the bytes. - * - * @param message the messages to verify - * @throws SchemaSerializationException if it is not a valid message - */ - default void validate(byte[] message) { - decode(message); - } - - /** - * Encode an object representing the message content into a byte array. - * - * @param message - * the message object - * @return a byte array with the serialized content - * @throws SchemaSerializationException - * if the serialization fails - */ - byte[] encode(T message); - - /** - * Returns whether this schema supports versioning. - * - *

Most of the schema implementations don't really support schema versioning, or it just doesn't - * make any sense to support schema versionings (e.g. primitive schemas). Only schema returns - * {@link GenericRecord} should support schema versioning. - * - *

If a schema implementation returns false, it should implement {@link #decode(byte[])}; - * while a schema implementation returns true, it should implement {@link #decode(byte[], byte[])} - * instead. - * - * @return true if this schema implementation supports schema versioning; otherwise returns false. - */ - default boolean supportSchemaVersioning() { - return false; - } - - - /** - * Decode a byte array into an object using the schema definition and deserializer implementation. - * - * @param bytes - * the byte array to decode - * @return the deserialized object - */ - default T decode(byte[] bytes) { - // use `null` to indicate ignoring schema version - return decode(bytes, null); - } - - /** - * Decode a byte array into an object using a given version. - * - * @param bytes - * the byte array to decode - * @param schemaVersion - * the schema version to decode the object. null indicates using latest version. - * @return the deserialized object - */ - default T decode(byte[] bytes, byte[] schemaVersion) { - // ignore version by default (most of the primitive schema implementations ignore schema version) - return decode(bytes); - } - +public interface Schema extends Cloneable { + + /** + * Check if the message is a valid object for this schema. + * + *

The implementation can choose what its most efficient approach to validate the schema. + * If the implementation doesn't provide it, it will attempt to use {@link #decode(byte[])} + * to see if this schema can decode this message or not as a validation mechanism to verify + * the bytes. + * + * @param message the messages to verify + * @throws SchemaSerializationException if it is not a valid message + */ + default void validate(byte[] message) { + decode(message); + } + + /** + * Encode an object representing the message content into a byte array. + * + * @param message the message object + * @return a byte array with the serialized content + * @throws SchemaSerializationException if the serialization fails + */ + byte[] encode(T message); + + /** + * Returns whether this schema supports versioning. + * + *

Most of the schema implementations don't really support schema versioning, or it just doesn't + * make any sense to support schema versionings (e.g. primitive schemas). Only schema returns + * {@link GenericRecord} should support schema versioning. + * + *

If a schema implementation returns false, it should implement {@link #decode(byte[])}; + * while a schema implementation returns true, it should implement {@link #decode(byte[], byte[])} + * instead. + * + * @return true if this schema implementation supports schema versioning; otherwise returns false. + */ + default boolean supportSchemaVersioning() { + return false; + } + + /** + * Decode a byte array into an object using the schema definition and deserializer implementation. + * + * @param bytes the byte array to decode + * @return the deserialized object + */ + default T decode(byte[] bytes) { + // use `null` to indicate ignoring schema version + return decode(bytes, null); + } + + /** + * Decode a byte array into an object using a given version. + * + * @param bytes the byte array to decode + * @param schemaVersion the schema version to decode the object. null indicates using latest version. + * @return the deserialized object + */ + default T decode(byte[] bytes, byte[] schemaVersion) { + // ignore version by default (most of the primitive schema implementations ignore schema version) + return decode(bytes); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java index d0ea0e0bde..889bf3de5b 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java @@ -1,15 +1,12 @@ package com.alibaba.cloud.integration.common.nacos; public class Const { - - public static final Integer NACOS_SERVER_PORT = 8848; - - private static final String CONFIG_INSTANCE_PATH = "/nacos/v1/ns"; - - public static final String NACOS_SERVER_URL = "http://127.0.0.1:" + NACOS_SERVER_PORT + CONFIG_INSTANCE_PATH; - - public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", - "nacos-server-test"); - - + + public static final Integer NACOS_SERVER_PORT = 8848; + public static final String DEFAULT_IMAGE_NAME = System.getenv() + .getOrDefault("TEST_IMAGE_NAME", "nacos-server-test"); + private static final String CONFIG_INSTANCE_PATH = "/nacos/v1/ns"; + public static final String NACOS_SERVER_URL = + "http://127.0.0.1:" + NACOS_SERVER_PORT + CONFIG_INSTANCE_PATH; + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java index b567b1ac7e..d0a4186890 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java @@ -19,21 +19,21 @@ import org.springframework.util.MultiValueMap; public class Params { - - private MultiValueMap paramMap; - - public static Params newParams() { - Params params = new Params(); - params.paramMap = new LinkedMultiValueMap(); - return params; - } - - public Params appendParam(String name, String value) { - this.paramMap.add(name, value); - return this; - } - - public MultiValueMap done() { - return paramMap; - } + + private MultiValueMap paramMap; + + public static Params newParams() { + Params params = new Params(); + params.paramMap = new LinkedMultiValueMap(); + return params; + } + + public Params appendParam(String name, String value) { + this.paramMap.add(name, value); + return this; + } + + public MultiValueMap done() { + return paramMap; + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java index ddd406b990..e882efea56 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java @@ -25,27 +25,29 @@ import java.util.Map; public class TextChangeParser implements ConfigChangeParser { - @Override - public boolean isResponsibleFor(String type) { - return (null == type || "text".equalsIgnoreCase(type)); - } - - @Override - public Map doParse(String oldContent, String newContent, String type) throws IOException { - Map map = new HashMap<>(4); - final String key = "content"; - - ConfigChangeItem cci = new ConfigChangeItem(key, oldContent, newContent); - if (null == oldContent && null != newContent) { - cci.setType(PropertyChangeType.ADDED); - } else if (null != oldContent && null != newContent && !oldContent.equals(newContent)) { - cci.setType(PropertyChangeType.MODIFIED); - } else if (null != oldContent && null == newContent) { - cci.setType(PropertyChangeType.DELETED); - } - map.put(key, cci); - - return map; - } + @Override public boolean isResponsibleFor(String type) { + return (null == type || "text".equalsIgnoreCase(type)); + } + + @Override public Map doParse(String oldContent, + String newContent, String type) throws IOException { + Map map = new HashMap<>(4); + final String key = "content"; + + ConfigChangeItem cci = new ConfigChangeItem(key, oldContent, newContent); + if (null == oldContent && null != newContent) { + cci.setType(PropertyChangeType.ADDED); + } + else if (null != oldContent && null != newContent && !oldContent.equals( + newContent)) { + cci.setType(PropertyChangeType.MODIFIED); + } + else if (null != oldContent && null == newContent) { + cci.setType(PropertyChangeType.DELETED); + } + map.put(key, cci); + + return map; + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java index c9089ff417..e7b5cc541c 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java @@ -6,9 +6,9 @@ * 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 - * + *

+ * 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 @@ -19,14 +19,16 @@ package com.alibaba.cloud.integration.docker; public class ContainerExecException extends Exception { - private final ContainerExecResult result; - - public ContainerExecException(String cmd, String containerId, ContainerExecResult result) { - super(String.format("%s failed on %s with error code %d", cmd, containerId, result.getExitCode())); - this.result = result; - } - - public ContainerExecResult getResult() { - return result; - } + private final ContainerExecResult result; + + public ContainerExecException(String cmd, String containerId, + ContainerExecResult result) { + super(String.format("%s failed on %s with error code %d", cmd, + containerId, result.getExitCode())); + this.result = result; + } + + public ContainerExecResult getResult() { + return result; + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java index 4c90845ced..3d80ca3a6a 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java @@ -4,25 +4,24 @@ import static org.assertj.core.api.Assertions.assertThat; -@Data(staticConstructor = "of") -public class ContainerExecResult { - - private final int exitCode; - private final String stdout; - private final String stderr; - - public void assertNoOutput() { - assertNoStdout(); - assertNoStderr(); - } - - public void assertNoStdout() { - assertThat(stdout.isEmpty()) - .isEqualTo("stdout should be empty, but was '" + stdout + "'"); - } - - public void assertNoStderr() { - assertThat(stdout.isEmpty()) - .isEqualTo("stderr should be empty, but was '" + stderr + "'"); - } +@Data(staticConstructor = "of") public class ContainerExecResult { + + private final int exitCode; + private final String stdout; + private final String stderr; + + public void assertNoOutput() { + assertNoStdout(); + assertNoStderr(); + } + + public void assertNoStdout() { + assertThat(stdout.isEmpty()).isEqualTo( + "stdout should be empty, but was '" + stdout + "'"); + } + + public void assertNoStderr() { + assertThat(stdout.isEmpty()).isEqualTo( + "stderr should be empty, but was '" + stderr + "'"); + } } \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java index 2441851e09..1c56e9ea7e 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java @@ -2,11 +2,10 @@ import lombok.Data; -@Data(staticConstructor = "of") -public class ContainerExecResultBytes { - - private final int exitCode; - private final byte[] stdout; - private final byte[] stderr; - +@Data(staticConstructor = "of") public class ContainerExecResultBytes { + + private final int exitCode; + private final byte[] stdout; + private final byte[] stderr; + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java index bacd9a24b1..8a31046ae9 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java @@ -6,9 +6,9 @@ * 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 - * + *

+ * 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 @@ -18,15 +18,6 @@ */ package com.alibaba.cloud.integration.utils; -import java.io.*; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.zip.GZIPOutputStream; - import com.alibaba.cloud.integration.docker.ContainerExecException; import com.alibaba.cloud.integration.docker.ContainerExecResult; import com.alibaba.cloud.integration.docker.ContainerExecResultBytes; @@ -41,376 +32,400 @@ import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.compress.utils.IOUtils; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.zip.GZIPOutputStream; + import static java.nio.charset.StandardCharsets.UTF_8; public class DockerUtils { - private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class); - - private static File getTargetDirectory(String containerId) { - String base = System.getProperty("maven.buildDirectory"); - if (base == null) { - base = "target"; - } - File directory = new File(base + "/container-logs/" + containerId); - if (!directory.exists() && !directory.mkdirs()) { - LOG.error("Error creating directory for container logs."); - } - return directory; - } - - public static void dumpContainerLogToTarget(DockerClient dockerClient, String containerId) { - final String containerName = getContainerName(dockerClient, containerId); - File output = getUniqueFileInTargetDirectory(containerName, "docker", ".log"); - try (OutputStream os = new BufferedOutputStream(new FileOutputStream(output))) { - CompletableFuture future = new CompletableFuture<>(); - dockerClient.logContainerCmd(containerName).withStdOut(true) - .withStdErr(true).withTimestamps(true).exec(new ResultCallback() { - @Override - public void close() { - } - - @Override - public void onStart(Closeable closeable) { - } - - @Override - public void onNext(Frame object) { - try { - os.write(object.getPayload()); - } catch (IOException e) { - onError(e); - } - } - - @Override - public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override - public void onComplete() { - future.complete(true); - } - }); - future.get(); - } catch (RuntimeException | ExecutionException | IOException e) { - LOG.error("Error dumping log for {}", containerName, e); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - LOG.info("Interrupted dumping log from container {}", containerName, ie); - } - } - - private static File getUniqueFileInTargetDirectory(String containerName, String prefix, String suffix) { - return getUniqueFileInDirectory(getTargetDirectory(containerName), prefix, suffix); - } - - private static File getUniqueFileInDirectory(File directory, String prefix, String suffix) { - File file = new File(directory, prefix + suffix); - int i = 0; - while (file.exists()) { - LOG.info("{} exists, incrementing", file); - file = new File(directory, prefix + "_" + (i++) + suffix); - } - return file; - } - - private static String getContainerName(DockerClient dockerClient, String containerId) { - final InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(containerId).exec(); - // docker api returns names prefixed with "/", it's part of it's legacy design, - // this removes it to be consistent with what docker ps shows. - return inspectContainerResponse.getName().replace("/", ""); - } - - public static void dumpContainerDirToTargetCompressed(DockerClient dockerClient, String containerId, - String path) { - final String containerName = getContainerName(dockerClient, containerId); - final String baseName = path.replace("/", "-").replaceAll("^-", ""); - File output = getUniqueFileInTargetDirectory(containerName, baseName, ".tar.gz"); - try (InputStream dockerStream = dockerClient.copyArchiveFromContainerCmd(containerId, path).exec(); - OutputStream os = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(output)))) { - IOUtils.copy(dockerStream, os); - } catch (RuntimeException | IOException e) { - if (!(e instanceof NotFoundException)) { - LOG.error("Error reading dir from container {}", containerName, e); - } - } - } - - public static void dumpContainerLogDirToTarget(DockerClient docker, String containerId, - String path) { - File targetDirectory = getTargetDirectory(containerId); - try (InputStream dockerStream = docker.copyArchiveFromContainerCmd(containerId, path).exec(); - TarArchiveInputStream stream = new TarArchiveInputStream(dockerStream)) { - TarArchiveEntry entry = stream.getNextTarEntry(); - while (entry != null) { - if (entry.isFile()) { - File output = new File(targetDirectory, entry.getName().replace("/", "-")); - Files.copy(stream, output.toPath(), StandardCopyOption.REPLACE_EXISTING); - } - entry = stream.getNextTarEntry(); - } - } catch (RuntimeException | IOException e) { - LOG.error("Error reading logs from container {}", containerId, e); - } - } - - public static String getContainerIP(DockerClient docker, String containerId) { - for (Map.Entry e : docker.inspectContainerCmd(containerId) - .exec().getNetworkSettings().getNetworks().entrySet()) { - return e.getValue().getIpAddress(); - } - throw new IllegalArgumentException("Container " + containerId + " has no networks"); - } - - public static ContainerExecResult runCommand(DockerClient docker, - String containerId, - String... cmd) - throws ContainerExecException, ExecutionException, InterruptedException { - try { - return runCommandAsync(docker, containerId, cmd).get(); - } catch (ExecutionException e) { - if (e.getCause() instanceof ContainerExecException) { - throw (ContainerExecException) e.getCause(); - } - throw e; - } - } - - public static ContainerExecResult runCommandAsUser(String userId, - DockerClient docker, - String containerId, - String... cmd) - throws ContainerExecException, ExecutionException, InterruptedException { - try { - return runCommandAsyncAsUser(userId, docker, containerId, cmd).get(); - } catch (ExecutionException e) { - if (e.getCause() instanceof ContainerExecException) { - throw (ContainerExecException) e.getCause(); - } - throw e; - } - } - - public static CompletableFuture runCommandAsyncAsUser(String userId, - DockerClient dockerClient, - String containerId, - String... cmd) { - String execId = dockerClient.execCreateCmd(containerId) - .withCmd(cmd) - .withAttachStderr(true) - .withAttachStdout(true) - .withUser(userId) - .exec() - .getId(); - return runCommandAsync(execId, dockerClient, containerId, cmd); - } - - public static CompletableFuture runCommandAsync(DockerClient dockerClient, - String containerId, - String... cmd) { - String execId = dockerClient.execCreateCmd(containerId) - .withCmd(cmd) - .withAttachStderr(true) - .withAttachStdout(true) - .exec() - .getId(); - return runCommandAsync(execId, dockerClient, containerId, cmd); - } - - private static CompletableFuture runCommandAsync(String execId, - DockerClient dockerClient, - String containerId, - String... cmd) { - CompletableFuture future = new CompletableFuture<>(); - final String containerName = getContainerName(dockerClient, containerId); - String cmdString = String.join(" ", cmd); - StringBuilder stdout = new StringBuilder(); - StringBuilder stderr = new StringBuilder(); - dockerClient.execStartCmd(execId).withDetach(false) - .exec(new ResultCallback() { - @Override - public void close() { - } - - @Override - public void onStart(Closeable closeable) { - LOG.info("DOCKER.exec({}:{}): Executing...", containerName, cmdString); - } - - @Override - public void onNext(Frame object) { - LOG.info("DOCKER.exec({}:{}): {}", containerName, cmdString, object); - if (StreamType.STDOUT == object.getStreamType()) { - stdout.append(new String(object.getPayload(), UTF_8)); - } else if (StreamType.STDERR == object.getStreamType()) { - stderr.append(new String(object.getPayload(), UTF_8)); - } - } - - @Override - public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override - public void onComplete() { - LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); - - InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); - int retCode = resp.getExitCode(); - ContainerExecResult result = ContainerExecResult.of( - retCode, - stdout.toString(), - stderr.toString() - ); - LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, retCode); - - if (retCode != 0) { - LOG.error( - "DOCKER.exec({}:{}): completed with non zero return code: {}\nstdout: {}\nstderr:" - + " {}", - containerName, cmdString, result.getExitCode(), result.getStdout(), - result.getStderr()); - future.completeExceptionally(new ContainerExecException(cmdString, containerId, result)); - } else { - future.complete(result); - } - } - }); - return future; - } - - public static ContainerExecResultBytes runCommandWithRawOutput(DockerClient dockerClient, - String containerId, - String... cmd) throws ContainerExecException { - CompletableFuture future = new CompletableFuture<>(); - String execId = dockerClient.execCreateCmd(containerId) - .withCmd(cmd) - .withAttachStderr(true) - .withAttachStdout(true) - .exec() - .getId(); - final String containerName = getContainerName(dockerClient, containerId); - String cmdString = String.join(" ", cmd); - ByteArrayOutputStream stdout = new ByteArrayOutputStream(); - ByteArrayOutputStream stderr = new ByteArrayOutputStream(); - dockerClient.execStartCmd(execId).withDetach(false) - .exec(new ResultCallback() { - @Override - public void close() { - } - - @Override - public void onStart(Closeable closeable) { - LOG.info("DOCKER.exec({}:{}): Executing...", containerName, cmdString); - } - - @Override - public void onNext(Frame object) { - try { - if (StreamType.STDOUT == object.getStreamType()) { - stdout.write(object.getPayload()); - } else if (StreamType.STDERR == object.getStreamType()) { - stderr.write(object.getPayload()); - } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - @Override - public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override - public void onComplete() { - LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); - future.complete(true); - } - }); - future.join(); - - InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); - int retCode = resp.getExitCode(); - - ContainerExecResultBytes result = ContainerExecResultBytes.of( - retCode, - stdout.toByteArray(), - stderr.toByteArray()); - LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, retCode); - - if (retCode != 0) { - throw new ContainerExecException(cmdString, containerId, null); - } - return result; - } - - public static CompletableFuture runCommandAsyncWithLogging(DockerClient dockerClient, - String containerId, String... cmd) { - CompletableFuture future = new CompletableFuture<>(); - String execId = dockerClient.execCreateCmd(containerId) - .withCmd(cmd) - .withAttachStderr(true) - .withAttachStdout(true) - .exec() - .getId(); - final String containerName = getContainerName(dockerClient, containerId); - String cmdString = String.join(" ", cmd); - dockerClient.execStartCmd(execId).withDetach(false) - .exec(new ResultCallback() { - @Override - public void close() { - } - - @Override - public void onStart(Closeable closeable) { - LOG.info("DOCKER.exec({}:{}): Executing...", containerName, cmdString); - } - - @Override - public void onNext(Frame object) { - LOG.info("DOCKER.exec({}:{}): {}", containerName, cmdString, object); - } - - @Override - public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override - public void onComplete() { - LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); - InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); - int retCode = resp.getExitCode(); - LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, retCode); - future.complete(retCode); - } - }); - return future; - } - - private static InspectExecResponse waitForExecCmdToFinish(DockerClient dockerClient, String execId) { - InspectExecResponse resp = dockerClient.inspectExecCmd(execId).exec(); - while (resp.isRunning()) { - try { - Thread.sleep(200); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - throw new RuntimeException(ie); - } - resp = dockerClient.inspectExecCmd(execId).exec(); - } - return resp; - } - - public static Optional getContainerCluster(DockerClient docker, String containerId) { - return Optional.ofNullable(docker.inspectContainerCmd(containerId) - .exec().getConfig().getLabels().get("cluster")); - } + private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class); + + private static File getTargetDirectory(String containerId) { + String base = System.getProperty("maven.buildDirectory"); + if (base == null) { + base = "target"; + } + File directory = new File(base + "/container-logs/" + containerId); + if (!directory.exists() && !directory.mkdirs()) { + LOG.error("Error creating directory for container logs."); + } + return directory; + } + + public static void dumpContainerLogToTarget(DockerClient dockerClient, + String containerId) { + final String containerName = getContainerName(dockerClient, containerId); + File output = getUniqueFileInTargetDirectory(containerName, "docker", + ".log"); + try (OutputStream os = new BufferedOutputStream( + new FileOutputStream(output))) { + CompletableFuture future = new CompletableFuture<>(); + dockerClient.logContainerCmd(containerName).withStdOut(true) + .withStdErr(true).withTimestamps(true) + .exec(new ResultCallback() { + @Override public void close() { + } + + @Override public void onStart( + Closeable closeable) { + } + + @Override public void onNext(Frame object) { + try { + os.write(object.getPayload()); + } + catch (IOException e) { + onError(e); + } + } + + @Override public void onError( + Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override public void onComplete() { + future.complete(true); + } + }); + future.get(); + } + catch (RuntimeException | ExecutionException | IOException e) { + LOG.error("Error dumping log for {}", containerName, e); + } + catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + LOG.info("Interrupted dumping log from container {}", + containerName, ie); + } + } + + private static File getUniqueFileInTargetDirectory(String containerName, + String prefix, String suffix) { + return getUniqueFileInDirectory(getTargetDirectory(containerName), prefix, + suffix); + } + + private static File getUniqueFileInDirectory(File directory, String prefix, + String suffix) { + File file = new File(directory, prefix + suffix); + int i = 0; + while (file.exists()) { + LOG.info("{} exists, incrementing", file); + file = new File(directory, prefix + "_" + (i++) + suffix); + } + return file; + } + + private static String getContainerName(DockerClient dockerClient, + String containerId) { + final InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd( + containerId).exec(); + // docker api returns names prefixed with "/", it's part of it's legacy design, + // this removes it to be consistent with what docker ps shows. + return inspectContainerResponse.getName().replace("/", ""); + } + + public static void dumpContainerDirToTargetCompressed(DockerClient dockerClient, + String containerId, String path) { + final String containerName = getContainerName(dockerClient, containerId); + final String baseName = path.replace("/", "-").replaceAll("^-", ""); + File output = getUniqueFileInTargetDirectory(containerName, baseName, + ".tar.gz"); + try (InputStream dockerStream = dockerClient.copyArchiveFromContainerCmd( + containerId, path).exec(); + OutputStream os = new GZIPOutputStream( + new BufferedOutputStream(new FileOutputStream(output)))) { + IOUtils.copy(dockerStream, os); + } + catch (RuntimeException | IOException e) { + if (!(e instanceof NotFoundException)) { + LOG.error("Error reading dir from container {}", + containerName, e); + } + } + } + + public static void dumpContainerLogDirToTarget(DockerClient docker, + String containerId, String path) { + File targetDirectory = getTargetDirectory(containerId); + try (InputStream dockerStream = docker.copyArchiveFromContainerCmd( + containerId, path).exec(); + TarArchiveInputStream stream = new TarArchiveInputStream( + dockerStream)) { + TarArchiveEntry entry = stream.getNextTarEntry(); + while (entry != null) { + if (entry.isFile()) { + File output = new File(targetDirectory, + entry.getName().replace("/", "-")); + Files.copy(stream, output.toPath(), + StandardCopyOption.REPLACE_EXISTING); + } + entry = stream.getNextTarEntry(); + } + } + catch (RuntimeException | IOException e) { + LOG.error("Error reading logs from container {}", containerId, e); + } + } + + public static String getContainerIP(DockerClient docker, String containerId) { + for (Map.Entry e : docker.inspectContainerCmd( + containerId).exec().getNetworkSettings().getNetworks() + .entrySet()) { + return e.getValue().getIpAddress(); + } + throw new IllegalArgumentException( + "Container " + containerId + " has no networks"); + } + + public static ContainerExecResult runCommand(DockerClient docker, + String containerId, String... cmd) + throws ContainerExecException, ExecutionException, InterruptedException { + try { + return runCommandAsync(docker, containerId, cmd).get(); + } + catch (ExecutionException e) { + if (e.getCause() instanceof ContainerExecException) { + throw (ContainerExecException) e.getCause(); + } + throw e; + } + } + + public static ContainerExecResult runCommandAsUser(String userId, + DockerClient docker, String containerId, String... cmd) + throws ContainerExecException, ExecutionException, InterruptedException { + try { + return runCommandAsyncAsUser(userId, docker, containerId, + cmd).get(); + } + catch (ExecutionException e) { + if (e.getCause() instanceof ContainerExecException) { + throw (ContainerExecException) e.getCause(); + } + throw e; + } + } + + public static CompletableFuture runCommandAsyncAsUser( + String userId, DockerClient dockerClient, String containerId, + String... cmd) { + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).withUser(userId) + .exec().getId(); + return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + public static CompletableFuture runCommandAsync( + DockerClient dockerClient, String containerId, String... cmd) { + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).exec().getId(); + return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + private static CompletableFuture runCommandAsync( + String execId, DockerClient dockerClient, String containerId, + String... cmd) { + CompletableFuture future = new CompletableFuture<>(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + StringBuilder stdout = new StringBuilder(); + StringBuilder stderr = new StringBuilder(); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override public void close() { + } + + @Override public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", + containerName, cmdString); + } + + @Override public void onNext(Frame object) { + LOG.info("DOCKER.exec({}:{}): {}", containerName, + cmdString, object); + if (StreamType.STDOUT == object.getStreamType()) { + stdout.append( + new String(object.getPayload(), + UTF_8)); + } + else if (StreamType.STDERR + == object.getStreamType()) { + stderr.append( + new String(object.getPayload(), + UTF_8)); + } + } + + @Override public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", + containerName, cmdString); + + InspectExecResponse resp = waitForExecCmdToFinish( + dockerClient, execId); + int retCode = resp.getExitCode(); + ContainerExecResult result = ContainerExecResult.of( + retCode, stdout.toString(), + stderr.toString()); + LOG.info("DOCKER.exec({}:{}): completed with {}", + containerName, cmdString, retCode); + + if (retCode != 0) { + LOG.error( + "DOCKER.exec({}:{}): completed with non zero return code: {}\nstdout: {}\nstderr:" + + " {}", containerName, + cmdString, result.getExitCode(), + result.getStdout(), + result.getStderr()); + future.completeExceptionally( + new ContainerExecException( + cmdString, containerId, + result)); + } + else { + future.complete(result); + } + } + }); + return future; + } + + public static ContainerExecResultBytes runCommandWithRawOutput( + DockerClient dockerClient, String containerId, String... cmd) + throws ContainerExecException { + CompletableFuture future = new CompletableFuture<>(); + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).exec().getId(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + ByteArrayOutputStream stdout = new ByteArrayOutputStream(); + ByteArrayOutputStream stderr = new ByteArrayOutputStream(); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override public void close() { + } + + @Override public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", + containerName, cmdString); + } + + @Override public void onNext(Frame object) { + try { + if (StreamType.STDOUT + == object.getStreamType()) { + stdout.write(object.getPayload()); + } + else if (StreamType.STDERR + == object.getStreamType()) { + stderr.write(object.getPayload()); + } + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", + containerName, cmdString); + future.complete(true); + } + }); + future.join(); + + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); + int retCode = resp.getExitCode(); + + ContainerExecResultBytes result = ContainerExecResultBytes.of(retCode, + stdout.toByteArray(), stderr.toByteArray()); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, + cmdString, retCode); + + if (retCode != 0) { + throw new ContainerExecException(cmdString, containerId, null); + } + return result; + } + + public static CompletableFuture runCommandAsyncWithLogging( + DockerClient dockerClient, String containerId, String... cmd) { + CompletableFuture future = new CompletableFuture<>(); + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).exec().getId(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override public void close() { + } + + @Override public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", + containerName, cmdString); + } + + @Override public void onNext(Frame object) { + LOG.info("DOCKER.exec({}:{}): {}", containerName, + cmdString, object); + } + + @Override public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", + containerName, cmdString); + InspectExecResponse resp = waitForExecCmdToFinish( + dockerClient, execId); + int retCode = resp.getExitCode(); + LOG.info("DOCKER.exec({}:{}): completed with {}", + containerName, cmdString, retCode); + future.complete(retCode); + } + }); + return future; + } + + private static InspectExecResponse waitForExecCmdToFinish( + DockerClient dockerClient, String execId) { + InspectExecResponse resp = dockerClient.inspectExecCmd(execId).exec(); + while (resp.isRunning()) { + try { + Thread.sleep(200); + } + catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + throw new RuntimeException(ie); + } + resp = dockerClient.inspectExecCmd(execId).exec(); + } + return resp; + } + + public static Optional getContainerCluster(DockerClient docker, + String containerId) { + return Optional.ofNullable( + docker.inspectContainerCmd(containerId).exec().getConfig() + .getLabels().get("cluster")); + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml index 9866e67eb6..326e8c05d5 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/assembly/docker-spring-cloud-assembly.xml @@ -1,4 +1,4 @@ - spring-cloud-alibaba-testcontainers-bin diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java index 613a70a2b6..4c8364be94 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java @@ -1,49 +1,37 @@ package com.alibaba.cloud.integration.test.nacos; import com.alibaba.cloud.integration.common.ChaosContainer; -import com.github.dockerjava.api.model.ExposedPort; -import com.github.dockerjava.api.model.HostConfig; -import com.github.dockerjava.api.model.PortBinding; -import com.github.dockerjava.api.model.Ports; -import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; - -import java.time.Duration; -import java.time.temporal.ChronoUnit; import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_PORT; import static java.lang.String.format; - -public class NacosContainer> extends ChaosContainer { - - - public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", - "nacos"); - - @Override - protected void configure() { - super.configure(); - this.withNetworkAliases(DEFAULT_IMAGE_NAME) - .withExposedPorts(NACOS_SERVER_PORT) - .withCreateContainerCmdModifier( createContainerCmd -> { - createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); - createContainerCmd.withName(clusterName + "-" + DEFAULT_IMAGE_NAME); - } ); - - } - - public NacosContainer(String clusterName, String image) { - super(clusterName, image); - withExposedPorts(NACOS_SERVER_PORT) - .withCommand(format("/bin/bash -c ' cmd.withHostConfig( -// new HostConfig() -// .withPortBindings(new PortBinding(Ports.Binding.bindPort(8849), new ExposedPort(NACOS_SERVER_PORT)))));; - - } - - - - +public class NacosContainer> + extends ChaosContainer { + + public static final String DEFAULT_IMAGE_NAME = System.getenv() + .getOrDefault("TEST_IMAGE_NAME", "nacos"); + + public NacosContainer(String clusterName, String image) { + super(clusterName, image); + withExposedPorts(NACOS_SERVER_PORT).withCommand( + format("/bin/bash -c ' cmd.withHostConfig( + // new HostConfig() + // .withPortBindings(new PortBinding(Ports.Binding.bindPort(8849), new ExposedPort(NACOS_SERVER_PORT)))));; + + } + + @Override protected void configure() { + super.configure(); + this.withNetworkAliases(DEFAULT_IMAGE_NAME) + .withExposedPorts(NACOS_SERVER_PORT) + .withCreateContainerCmdModifier(createContainerCmd -> { + createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); + createContainerCmd.withName( + clusterName + "-" + DEFAULT_IMAGE_NAME); + }); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java index a8235f0124..eef2cbef10 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java @@ -3,82 +3,58 @@ import com.alibaba.cloud.integration.NacosConfig; import com.alibaba.cloud.integration.UserProperties; import com.alibaba.cloud.integration.common.NacosBootTester; -import com.alibaba.cloud.nacos.NacosConfigManager; import com.alibaba.cloud.nacos.NacosConfigProperties; -import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.exception.NacosException; import lombok.extern.slf4j.Slf4j; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; - -@Slf4j -public class NacosContainerTest extends NacosBootTester { - - private NacosContainer nacosContainer; - private static final String image = "freemanlau/nacos:1.4.2"; - - @Override - public void vaildateUpdateState(NacosConfig nacosConfig, NacosConfigProperties properties, UserProperties userProperties) throws NacosException { - super.vaildateUpdateState(nacosConfig, properties, userProperties); - } - - @Override - protected String uploadFile(UserProperties userProperties) { - - try{ - - - String content = - "configdata:\n" + - " user:\n" + - " age: 22\n" + - " name: freeman1123\n" + - " map:\n" + - " hobbies:\n" + - " - art\n" + - " - programming\n" + - " - movie\n" + - " intro: Hello, I'm freeman\n" + - " extra: yo~\n" + - " users:\n" + - " - name: dad\n" + - " age: 20\n" + - " - name: mom\n" + - " age: 18"; - return content; - }catch (Exception ex){ - log.error("Nacos pulish failed"); - return null; +@Slf4j public class NacosContainerTest extends NacosBootTester { + + private static final String image = "freemanlau/nacos:1.4.2"; + private NacosContainer nacosContainer; + + @Override public void vaildateUpdateState(NacosConfig nacosConfig, + NacosConfigProperties properties, UserProperties userProperties) + throws NacosException { + super.vaildateUpdateState(nacosConfig, properties, userProperties); } - } - - - - @Before - public void setUp() throws Exception{ - nacosContainer = new NacosContainer("nacos-example",image); - nacosContainer.start(); - } - - @After - public void cleanup() throws Exception{ - - } - - @Test - public void testNacosStartUp() throws Exception{ - NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); - UserProperties userProperties = new UserProperties(); - NacosConfig nacosConfig = NacosConfig.builder(). - build(); - vaildateUpdateState(nacosConfig,nacosConfigProperties,userProperties); - } - - + + @Override protected String uploadFile(UserProperties userProperties) { + + try { + + String content = "configdata:\n" + " user:\n" + " age: 22\n" + + " name: freeman1123\n" + " map:\n" + + " hobbies:\n" + " - art\n" + + " - programming\n" + " - movie\n" + + " intro: Hello, I'm freeman\n" + + " extra: yo~\n" + " users:\n" + + " - name: dad\n" + " age: 20\n" + + " - name: mom\n" + " age: 18"; + return content; + } + catch (Exception ex) { + log.error("Nacos pulish failed"); + return null; + } + } + + @Before public void setUp() throws Exception { + nacosContainer = new NacosContainer("nacos-example", image); + nacosContainer.start(); + } + + @After public void cleanup() throws Exception { + + } + + @Test public void testNacosStartUp() throws Exception { + NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); + UserProperties userProperties = new UserProperties(); + NacosConfig nacosConfig = NacosConfig.builder().build(); + vaildateUpdateState(nacosConfig, nacosConfigProperties, userProperties); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java index 52c1629dc8..4b228e8585 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java @@ -30,135 +30,126 @@ import org.junit.Test; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.TimeUnit; import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_URL; public class NacosAsyncRestTemplateITCase { - - private NacosAsyncRestTemplate nacosRestTemplate = HttpClientBeanHolder - .getNacosAsyncRestTemplate(LoggerFactory.getLogger(NacosAsyncRestTemplateITCase.class)); - - private NacosContainer nacosContainer; - private static final String image = "nacos/nacos-server:latest"; - - - @Before - public void setUp() throws NacosException { - nacosContainer = new NacosContainer("nacos-example",image); - nacosContainer.start(); - } - - private class CallbackMap implements Callback { - - private HttpRestResult restResult; - - private Throwable throwable; - - @Override - public void onReceive(RestResult result) { - restResult = (HttpRestResult) result; - } - - @Override - public void onError(Throwable throwable) { - this.throwable = throwable; - } - - @Override - public void onCancel() { - - } - - public HttpRestResult getRestResult() { - return restResult; - } - - public Throwable getThrowable() { - return throwable; - } - } - - @Test - public void test_url_post_form() throws Exception { - - String url = NACOS_SERVER_URL + "/instance"; - Map param = new HashMap<>(); - param.put("serviceName", "app-test"); - param.put("port", "8080"); - param.put("ip", "127.0.0.1"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, String.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - } - - @Test - public void test_url_put_form() throws Exception { - String url = NACOS_SERVER_URL + "/instance"; - Map param = new HashMap<>(); - param.put("serviceName", "app-test-change"); - param.put("port", "8080"); - param.put("ip", "11.11.11.11"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, String.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - } - - - @Test - public void test_url_get() throws Exception { - String url = NACOS_SERVER_URL + "/instance/list"; - Query query = Query.newInstance().addParam("serviceName", "app-test"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.get(url, Header.newInstance(), query, Map.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - Assert.assertEquals(restResult.getData().get("name"), "DEFAULT_GROUP@@app-test"); - } - - @Test - public void test_url_by_map() throws Exception { - String url = NACOS_SERVER_URL + "/instance/list"; - Map param = new HashMap<>(); - param.put("serviceName", "app-test"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.get(url, Header.newInstance(), Query.newInstance().initParams(param), Map.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - Assert.assertEquals(restResult.getData().get("name"), "DEFAULT_GROUP@@app-test"); - } - - @Test - public void test_url_delete() throws Exception { - String url = NACOS_SERVER_URL + "/instance"; - Query query = Query.newInstance().addParam("ip", "11.11.11.11").addParam("port", "8080") - .addParam("serviceName", "app-test"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.delete(url, Header.newInstance(), query, String.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - } - + + private static final String image = "nacos/nacos-server:latest"; + private final NacosAsyncRestTemplate nacosRestTemplate = HttpClientBeanHolder.getNacosAsyncRestTemplate( + LoggerFactory.getLogger(NacosAsyncRestTemplateITCase.class)); + private NacosContainer nacosContainer; + + @Before public void setUp() throws NacosException { + nacosContainer = new NacosContainer("nacos-example", image); + nacosContainer.start(); + } + + @Test public void test_url_post_form() throws Exception { + + String url = NACOS_SERVER_URL + "/instance"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test"); + param.put("port", "8080"); + param.put("ip", "127.0.0.1"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), + param, String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + @Test public void test_url_put_form() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test-change"); + param.put("port", "8080"); + param.put("ip", "11.11.11.11"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), + param, String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + @Test public void test_url_get() throws Exception { + String url = NACOS_SERVER_URL + "/instance/list"; + Query query = Query.newInstance().addParam("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.get(url, Header.newInstance(), query, Map.class, + callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + Assert.assertEquals(restResult.getData().get("name"), + "DEFAULT_GROUP@@app-test"); + } + + @Test public void test_url_by_map() throws Exception { + String url = NACOS_SERVER_URL + "/instance/list"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.get(url, Header.newInstance(), + Query.newInstance().initParams(param), Map.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + Assert.assertEquals(restResult.getData().get("name"), + "DEFAULT_GROUP@@app-test"); + } + + @Test public void test_url_delete() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Query query = Query.newInstance().addParam("ip", "11.11.11.11") + .addParam("port", "8080").addParam("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.delete(url, Header.newInstance(), query, String.class, + callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + private class CallbackMap implements Callback { + + private HttpRestResult restResult; + + private Throwable throwable; + + @Override public void onReceive(RestResult result) { + restResult = (HttpRestResult) result; + } + + @Override public void onError(Throwable throwable) { + this.throwable = throwable; + } + + @Override public void onCancel() { + + } + + public HttpRestResult getRestResult() { + return restResult; + } + + public Throwable getThrowable() { + return throwable; + } + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java index 00cb1e2d8c..b60f0db030 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java @@ -1,6 +1,5 @@ package com.alibaba.cloud.integration.test.nacos.core; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; @@ -13,36 +12,38 @@ import java.net.URL; public class HttpClient4Test { - - protected URL baseURL; - - @Autowired - protected TestRestTemplate restTemplate; - - protected ResponseEntity request(String path, MultiValueMap params, Class clazz) { - - HttpHeaders headers = new HttpHeaders(); - - HttpEntity entity = new HttpEntity(headers); - - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.baseURL.toString() + path) - .queryParams(params); - - return this.restTemplate.exchange( - builder.toUriString(), HttpMethod.GET, entity, clazz); - } - - protected ResponseEntity request(String path, MultiValueMap params, Class clazz, HttpMethod httpMethod) { - - HttpHeaders headers = new HttpHeaders(); - - HttpEntity entity = new HttpEntity(headers); - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.baseURL.toString() + path) - .queryParams(params); + protected URL baseURL; + + @Autowired protected TestRestTemplate restTemplate; + + protected ResponseEntity request(String path, + MultiValueMap params, Class clazz) { + + HttpHeaders headers = new HttpHeaders(); + + HttpEntity entity = new HttpEntity(headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl( + this.baseURL.toString() + path).queryParams(params); + + return this.restTemplate.exchange(builder.toUriString(), HttpMethod.GET, + entity, clazz); + } + + protected ResponseEntity request(String path, + MultiValueMap params, Class clazz, + HttpMethod httpMethod) { + + HttpHeaders headers = new HttpHeaders(); + + HttpEntity entity = new HttpEntity(headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl( + this.baseURL.toString() + path).queryParams(params); + + return this.restTemplate.exchange(builder.toUriString(), httpMethod, + entity, clazz); + } - return this.restTemplate.exchange( - builder.toUriString(), httpMethod, entity, clazz); - } - } \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java index 9edb51775e..be6bf2abdb 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java @@ -1,9 +1,5 @@ package com.alibaba.cloud.integration.test.rocketmq; -import java.time.Duration; -import java.util.Objects; -import java.util.UUID; - import com.alibaba.cloud.integration.common.ChaosContainer; import com.alibaba.cloud.integration.utils.DockerUtils; import lombok.extern.slf4j.Slf4j; @@ -11,170 +7,151 @@ import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; -import static java.time.temporal.ChronoUnit.SECONDS; - -@Slf4j -public abstract class RocketmqContainer> extends ChaosContainer { - - public static final int INVALID_PORT = -1; - public static final int ZK_PORT = 2181; - public static final int CS_PORT = 2184; - public static final int BOOKIE_PORT = 3181; - public static final int BROKER_PORT = 6650; - public static final int BROKER_HTTP_PORT = 8080; - - public static final String DEFAULT_IMAGE_NAME = System.getenv().getOrDefault("TEST_IMAGE_NAME", - ""); - - /** - * For debugging purposes, it is useful to have the ability to leave containers running. - * This mode can be activated by setting environment variables - * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true - * After debugging, one can use this command to kill all containers that were left running: - * docker kill $(docker ps -q --filter "label=markcontainer=true") - */ - public static final boolean CONTAINERS_LEAVE_RUNNING = - Boolean.parseBoolean(System.getenv("CONTAINERS_LEAVE_RUNNING")); - - - private final String hostname; - private final String serviceName; - private final String serviceEntryPoint; - private final int servicePort; - private final int httpPort; - private final String httpPath; - - public RocketmqContainer(String clusterName, - String hostname, - String serviceName, - String serviceEntryPoint, - int servicePort, - int httpPort) { - this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, "/metrics"); - } - - - public RocketmqContainer(String clusterName, - String hostname, - String serviceName, - String serviceEntryPoint, - int servicePort, - int httpPort, - String httpPath) { - this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, httpPath, - DEFAULT_IMAGE_NAME); - } +import java.time.Duration; +import java.util.Objects; +import java.util.UUID; - public RocketmqContainer(String clusterName, - String hostname, - String serviceName, - String serviceEntryPoint, - int servicePort, - int httpPort, - String httpPath, - String pulsarImageName) { - super(clusterName, pulsarImageName); - this.hostname = hostname; - this.serviceName = serviceName; - this.serviceEntryPoint = serviceEntryPoint; - this.servicePort = servicePort; - this.httpPort = httpPort; - this.httpPath = httpPath; +import static java.time.temporal.ChronoUnit.SECONDS; - configureLeaveContainerRunning(this); - } - - public static void configureLeaveContainerRunning( - GenericContainer container) { - if (CONTAINERS_LEAVE_RUNNING) { - // use Testcontainers reuse containers feature to leave the container running - container.withReuse(true); - // add label that can be used to find containers that are left running. - container.withLabel("markcontainer", "true"); - // add a random label to prevent reuse of containers - container.withLabel("markcontainer.random", UUID.randomUUID().toString()); +@Slf4j public abstract class RocketmqContainer> + extends ChaosContainer { + + public static final int INVALID_PORT = -1; + public static final int ZK_PORT = 2181; + public static final int CS_PORT = 2184; + public static final int BOOKIE_PORT = 3181; + public static final int BROKER_PORT = 6650; + public static final int BROKER_HTTP_PORT = 8080; + + public static final String DEFAULT_IMAGE_NAME = System.getenv() + .getOrDefault("TEST_IMAGE_NAME", ""); + + /** + * For debugging purposes, it is useful to have the ability to leave containers running. + * This mode can be activated by setting environment variables + * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true + * After debugging, one can use this command to kill all containers that were left running: + * docker kill $(docker ps -q --filter "label=markcontainer=true") + */ + public static final boolean CONTAINERS_LEAVE_RUNNING = Boolean.parseBoolean( + System.getenv("CONTAINERS_LEAVE_RUNNING")); + + private final String hostname; + private final String serviceName; + private final String serviceEntryPoint; + private final int servicePort; + private final int httpPort; + private final String httpPath; + + public RocketmqContainer(String clusterName, String hostname, String serviceName, + String serviceEntryPoint, int servicePort, int httpPort) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, + httpPort, "/metrics"); } - } - - @Override - protected void beforeStop() { - super.beforeStop(); - if (null != getContainerId()) { - DockerUtils.dumpContainerDirToTargetCompressed( - getDockerClient(), - getContainerId(), - "/var/log/pulsar" - ); + + public RocketmqContainer(String clusterName, String hostname, String serviceName, + String serviceEntryPoint, int servicePort, int httpPort, + String httpPath) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, + httpPort, httpPath, DEFAULT_IMAGE_NAME); } - } - - @Override - public void stop() { - if (CONTAINERS_LEAVE_RUNNING) { - log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); - return; + + public RocketmqContainer(String clusterName, String hostname, String serviceName, + String serviceEntryPoint, int servicePort, int httpPort, String httpPath, + String pulsarImageName) { + super(clusterName, pulsarImageName); + this.hostname = hostname; + this.serviceName = serviceName; + this.serviceEntryPoint = serviceEntryPoint; + this.servicePort = servicePort; + this.httpPort = httpPort; + this.httpPath = httpPath; + + configureLeaveContainerRunning(this); } - super.stop(); - } - - @Override - public String getContainerName() { - return clusterName + "-" + hostname; - } - - @Override - protected void configure() { - super.configure(); - if (httpPort > 0) { - addExposedPorts(httpPort); + + public static void configureLeaveContainerRunning(GenericContainer container) { + if (CONTAINERS_LEAVE_RUNNING) { + // use Testcontainers reuse containers feature to leave the container running + container.withReuse(true); + // add label that can be used to find containers that are left running. + container.withLabel("markcontainer", "true"); + // add a random label to prevent reuse of containers + container.withLabel("markcontainer.random", + UUID.randomUUID().toString()); + } } - if (servicePort > 0) { - addExposedPort(servicePort); + + @Override protected void beforeStop() { + super.beforeStop(); + if (null != getContainerId()) { + DockerUtils.dumpContainerDirToTargetCompressed(getDockerClient(), + getContainerId(), "/var/log/pulsar"); + } } - } - - protected void beforeStart() {} - - protected void afterStart() {} - - @Override - public void start() { - if (httpPort > 0 && servicePort < 0) { - this.waitStrategy = new HttpWaitStrategy() - .forPort(httpPort) - .forStatusCode(200) - .forPath(httpPath) - .withStartupTimeout(Duration.of(300, SECONDS)); - } else if (httpPort > 0 || servicePort > 0) { - this.waitStrategy = new HostPortWaitStrategy() - .withStartupTimeout(Duration.of(300, SECONDS)); + + @Override public void stop() { + if (CONTAINERS_LEAVE_RUNNING) { + log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); + return; + } + super.stop(); } - this.withCreateContainerCmdModifier(createContainerCmd -> { - createContainerCmd.withHostName(hostname); - createContainerCmd.withName(getContainerName()); - createContainerCmd.withEntrypoint(serviceEntryPoint); - }); - - beforeStart(); - super.start(); - afterStart(); - log.info("[{}] Start pulsar service {} at container {}", getContainerName(), serviceName, getContainerId()); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof RocketmqContainer)) { - return false; + + @Override public String getContainerName() { + return clusterName + "-" + hostname; + } + + @Override protected void configure() { + super.configure(); + if (httpPort > 0) { + addExposedPorts(httpPort); + } + if (servicePort > 0) { + addExposedPort(servicePort); + } + } + + protected void beforeStart() { + } + + protected void afterStart() { + } + + @Override public void start() { + if (httpPort > 0 && servicePort < 0) { + this.waitStrategy = new HttpWaitStrategy().forPort(httpPort) + .forStatusCode(200).forPath(httpPath) + .withStartupTimeout(Duration.of(300, SECONDS)); + } + else if (httpPort > 0 || servicePort > 0) { + this.waitStrategy = new HostPortWaitStrategy().withStartupTimeout( + Duration.of(300, SECONDS)); + } + this.withCreateContainerCmdModifier(createContainerCmd -> { + createContainerCmd.withHostName(hostname); + createContainerCmd.withName(getContainerName()); + createContainerCmd.withEntrypoint(serviceEntryPoint); + }); + + beforeStart(); + super.start(); + afterStart(); + log.info("[{}] Start pulsar service {} at container {}", + getContainerName(), serviceName, getContainerId()); + } + + @Override public boolean equals(Object o) { + if (!(o instanceof RocketmqContainer)) { + return false; + } + + RocketmqContainer another = (RocketmqContainer) o; + return getContainerId().equals(another.getContainerId()) && super.equals( + another); + } + + @Override public int hashCode() { + return 31 * super.hashCode() + Objects.hash(getContainerId()); } - - RocketmqContainer another = (RocketmqContainer) o; - return getContainerId().equals(another.getContainerId()) - && super.equals(another); - } - - @Override - public int hashCode() { - return 31 * super.hashCode() + Objects.hash( - getContainerId()); - } } From 27f0a022ba2431d01ccacd05040d401edb810f32 Mon Sep 17 00:00:00 2001 From: windwheel Date: Mon, 18 Jul 2022 00:11:01 +0800 Subject: [PATCH 25/26] fix checkstyle --- .../cloud/integration/NacosConfig.java | 22 +- .../cloud/integration/UserProperties.java | 24 +- .../integration/common/ChaosContainer.java | 176 +++-- .../cloud/integration/common/KeyValue.java | 203 ++--- .../integration/common/NacosBootTester.java | 45 +- .../common/RocketmqSourceTester.java | 303 +++---- .../cloud/integration/common/Schema.java | 137 ++-- .../cloud/integration/common/nacos/Const.java | 16 +- .../integration/common/nacos/Params.java | 34 +- .../common/nacos/TextChangeParser.java | 55 +- .../docker/ContainerExecException.java | 24 +- .../docker/ContainerExecResult.java | 31 +- .../docker/ContainerExecResultBytes.java | 15 +- .../cloud/integration/utils/DockerUtils.java | 737 +++++++++--------- .../test/nacos/NacosContainer.java | 47 +- .../test/nacos/NacosContainerTest.java | 94 +-- .../common/NacosAsyncRestTemplateITCase.java | 235 +++--- .../test/nacos/core/HttpClient4Test.java | 72 +- .../test/rocketmq/RocketmqContainer.java | 277 +++---- 19 files changed, 1289 insertions(+), 1258 deletions(-) diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java index ba9470c138..35933aef3b 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/NacosConfig.java @@ -3,14 +3,16 @@ import lombok.Builder; import lombok.Getter; -@Builder @Getter public class NacosConfig { - - private String dataId; - - private String namespace; - - private String group; - - private String type; - +@Builder +@Getter +public class NacosConfig { + + private String dataId; + + private String namespace; + + private String group; + + private String type; + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java index 752b452346..2bd4733d67 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/UserProperties.java @@ -16,23 +16,25 @@ package com.alibaba.cloud.integration; -import lombok.Data; - import java.util.List; import java.util.Map; +import lombok.Data; + /** * @author freeman */ -@Data public class UserProperties { +@Data +public class UserProperties { + private String name; + private Integer age; + private Map map; + private List users; + + @Data + public static class User { private String name; private Integer age; - private Map map; - private List users; - - @Data public static class User { - private String name; - private Integer age; - } - + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java index c68bd555d7..51fb193b1a 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/ChaosContainer.java @@ -1,94 +1,106 @@ package com.alibaba.cloud.integration.common; +import java.util.Base64; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; + import com.alibaba.cloud.integration.docker.ContainerExecResult; import com.alibaba.cloud.integration.utils.DockerUtils; import com.github.dockerjava.api.DockerClient; import lombok.extern.slf4j.Slf4j; import org.testcontainers.containers.GenericContainer; -import java.util.Base64; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; - -@Slf4j public class ChaosContainer> +@Slf4j +public class ChaosContainer> extends GenericContainer { - - protected final String clusterName; - - protected ChaosContainer(String clusterName, String image) { - super(image); - this.clusterName = clusterName; - } - - @Override protected void configure() { - super.configure(); - addEnv("MALLOC_ARENA_MAX", "1"); - } - - protected void beforeStop() { - if (null == getContainerId()) { - return; - } - - // dump the container log - DockerUtils.dumpContainerLogToTarget(getDockerClient(), getContainerId()); - } - - @Override public void stop() { - beforeStop(); - super.stop(); - } - - protected void tailContainerLog() { - withLogConsumer(item -> log.info(item.getUtf8String())); - } - - public void putFile(String path, byte[] contents) throws Exception { - String base64contents = Base64.getEncoder().encodeToString(contents); - String cmd = String.format("echo %s | base64 -d > %s", base64contents, - path); - execCmd("bash", "-c", cmd); - } - - public ContainerExecResult execCmd(String... commands) throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommand(client, dockerId, commands); - } - - public CompletableFuture execCmdAsync(String... commands) - throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommandAsync(client, dockerId, commands); - } - - public ContainerExecResult execCmdAsUser(String userId, String... commands) - throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommandAsUser(userId, client, dockerId, commands); - } - - public CompletableFuture execCmdAsyncAsUser(String userId, - String... commands) throws Exception { - DockerClient client = this.getDockerClient(); - String dockerId = this.getContainerId(); - return DockerUtils.runCommandAsyncAsUser(userId, client, dockerId, - commands); - } - - @Override public boolean equals(Object o) { - if (!(o instanceof ChaosContainer)) { - return false; - } - - ChaosContainer another = (ChaosContainer) o; - return clusterName.equals(another.clusterName) && super.equals(another); + + protected final String clusterName; + + protected ChaosContainer(String clusterName, String image) { + super(image); + this.clusterName = clusterName; + } + + /** + * Initialize container startup parameters + */ + @Override + protected void configure() { + super.configure(); + addEnv("MALLOC_ARENA_MAX", "1"); + } + + /** + * Do some preprocessing before the container stops + */ + protected void beforeStop() { + if (null == getContainerId()) { + return; } - - @Override public int hashCode() { - return 31 * super.hashCode() + Objects.hash(clusterName); + + // dump the container log + DockerUtils.dumpContainerLogToTarget(getDockerClient(), getContainerId()); + } + + /** + * container stopped + */ + @Override + public void stop() { + beforeStop(); + super.stop(); + } + + protected void tailContainerLog() { + withLogConsumer(item -> log.info(item.getUtf8String())); + } + + public void putFile(String path, byte[] contents) throws Exception { + String base64contents = Base64.getEncoder().encodeToString(contents); + String cmd = String.format("echo %s | base64 -d > %s", base64contents, path); + execCmd("bash", "-c", cmd); + } + + public ContainerExecResult execCmd(String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommand(client, dockerId, commands); + } + + public CompletableFuture execCmdAsync(String... commands) + throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsync(client, dockerId, commands); + } + + public ContainerExecResult execCmdAsUser(String userId, String... commands) + throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsUser(userId, client, dockerId, commands); + } + + public CompletableFuture execCmdAsyncAsUser(String userId, + String... commands) throws Exception { + DockerClient client = this.getDockerClient(); + String dockerId = this.getContainerId(); + return DockerUtils.runCommandAsyncAsUser(userId, client, dockerId, commands); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ChaosContainer)) { + return false; } - + + ChaosContainer another = (ChaosContainer) o; + return clusterName.equals(another.clusterName) && super.equals(another); + } + + @Override + public int hashCode() { + return 31 * super.hashCode() + Objects.hash(clusterName); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java index 426956bca0..0413ef81b7 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/KeyValue.java @@ -4,113 +4,116 @@ import java.util.Objects; public class KeyValue { - private final K key; - private final V value; - - public KeyValue(K key, V value) { - this.key = key; - this.value = value; - } - - /** - * Encode a key and value pair into a bytes array. - * - * @param key key object to encode - * @param keyWriter a writer to encode key object - * @param value value object to encode - * @param valueWriter a writer to encode value object - * @return the encoded bytes array - */ - public static byte[] encode(K key, Schema keyWriter, V value, - Schema valueWriter) { - byte[] keyBytes; - if (key == null) { - keyBytes = new byte[0]; - } - else { - keyBytes = keyWriter.encode(key); - } - - byte[] valueBytes; - if (value == null) { - valueBytes = new byte[0]; - } - else { - valueBytes = valueWriter.encode(value); - } - ByteBuffer byteBuffer = ByteBuffer.allocate( - 4 + keyBytes.length + 4 + valueBytes.length); - byteBuffer.putInt(key == null ? -1 : keyBytes.length).put(keyBytes) - .putInt(value == null ? -1 : valueBytes.length).put(valueBytes); - return byteBuffer.array(); + private final K key; + private final V value; + + public KeyValue(K key, V value) { + this.key = key; + this.value = value; + } + + /** + * Encode a key and value pair into a bytes array. + * + * @param key key object to encode + * @param keyWriter a writer to encode key object + * @param value value object to encode + * @param valueWriter a writer to encode value object + * @return the encoded bytes array + */ + public static byte[] encode(K key, Schema keyWriter, V value, + Schema valueWriter) { + byte[] keyBytes; + if (key == null) { + keyBytes = new byte[0]; } - - /** - * Decode the value into a key/value pair. - * - * @param data the encoded bytes - * @param decoder the decoder to decode encoded key/value bytes - * @return the decoded key/value pair - */ - public static KeyValue decode(byte[] data, - KeyValueDecoder decoder) { - ByteBuffer byteBuffer = ByteBuffer.wrap(data); - int keyLength = byteBuffer.getInt(); - byte[] keyBytes = keyLength == -1 ? null : new byte[keyLength]; - if (keyBytes != null) { - byteBuffer.get(keyBytes); - } - - int valueLength = byteBuffer.getInt(); - byte[] valueBytes = valueLength == -1 ? null : new byte[valueLength]; - if (valueBytes != null) { - byteBuffer.get(valueBytes); - } - - return decoder.decode(keyBytes, valueBytes); + else { + keyBytes = keyWriter.encode(key); } - - public K getKey() { - return key; + + byte[] valueBytes; + if (value == null) { + valueBytes = new byte[0]; } - - public V getValue() { - return value; + else { + valueBytes = valueWriter.encode(value); } - - @Override public int hashCode() { - return Objects.hash(key, value); + ByteBuffer byteBuffer = ByteBuffer + .allocate(4 + keyBytes.length + 4 + valueBytes.length); + byteBuffer.putInt(key == null ? -1 : keyBytes.length).put(keyBytes) + .putInt(value == null ? -1 : valueBytes.length).put(valueBytes); + return byteBuffer.array(); + } + + /** + * Decode the value into a key/value pair. + * + * @param data the encoded bytes + * @param decoder the decoder to decode encoded key/value bytes + * @return the decoded key/value pair + */ + public static KeyValue decode(byte[] data, + KeyValueDecoder decoder) { + ByteBuffer byteBuffer = ByteBuffer.wrap(data); + int keyLength = byteBuffer.getInt(); + byte[] keyBytes = keyLength == -1 ? null : new byte[keyLength]; + if (keyBytes != null) { + byteBuffer.get(keyBytes); } - - @Override public boolean equals(Object obj) { - if (!(obj instanceof KeyValue)) { - return false; - } - KeyValue another = (KeyValue) obj; - return Objects.equals(key, another.key) && Objects.equals(value, - another.value); + + int valueLength = byteBuffer.getInt(); + byte[] valueBytes = valueLength == -1 ? null : new byte[valueLength]; + if (valueBytes != null) { + byteBuffer.get(valueBytes); } - - @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("(key = \"").append(key).append("\", value = \"").append(value) - .append("\")"); - return sb.toString(); + + return decoder.decode(keyBytes, valueBytes); + } + + public K getKey() { + return key; + } + + public V getValue() { + return value; + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof KeyValue)) { + return false; } - + KeyValue another = (KeyValue) obj; + return Objects.equals(key, another.key) && Objects.equals(value, another.value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("(key = \"").append(key).append("\", value = \"").append(value) + .append("\")"); + return sb.toString(); + } + + /** + * Decoder to decode key/value bytes. + */ + @FunctionalInterface + public interface KeyValueDecoder { + /** - * Decoder to decode key/value bytes. + * Decode key and value bytes into a {@link KeyValue} pair. + * + * @param keyData key data + * @param valueData value data + * @return the decoded {@link KeyValue} pair */ - @FunctionalInterface public interface KeyValueDecoder { - - /** - * Decode key and value bytes into a {@link KeyValue} pair. - * - * @param keyData key data - * @param valueData value data - * @return the decoded {@link KeyValue} pair - */ - KeyValue decode(byte[] keyData, byte[] valueData); - - } + KeyValue decode(byte[] keyData, byte[] valueData); + + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java index 3131a8c4f6..7d7ef294c5 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/NacosBootTester.java @@ -11,28 +11,27 @@ import org.testcontainers.containers.GenericContainer; public abstract class NacosBootTester { - - private final Logger logger = LoggerFactory.getLogger(NacosBootTester.class); - - public void vaildateUpdateState(NacosConfig nacosConfig, - NacosConfigProperties properties, UserProperties userProperties) - throws NacosException { - - ConfigService configService = NacosConfigManager.createConfigService( - properties); - String content = uploadFile(userProperties); - try { - configService.publishConfig(nacosConfig.getDataId(), - nacosConfig.getGroup(), content, nacosConfig.getType()); - } - finally { - logger.info("nacos 配置文件已经上传完成"); - } + + private final Logger logger = LoggerFactory.getLogger(NacosBootTester.class); + + public void vaildateUpdateState(NacosConfig nacosConfig, + NacosConfigProperties properties, UserProperties userProperties) + throws NacosException { + + ConfigService configService = NacosConfigManager.createConfigService(properties); + String content = uploadFile(userProperties); + try { + configService.publishConfig(nacosConfig.getDataId(), nacosConfig.getGroup(), + content, nacosConfig.getType()); } - - /** - * nacos update yaml - */ - protected abstract String uploadFile(UserProperties userProperties); - + finally { + logger.info("nacos 配置文件已经上传完成"); + } + } + + /** + * nacos update yaml + */ + protected abstract String uploadFile(UserProperties userProperties); + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java index 9b09b2933a..0dd0c3d728 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/RocketmqSourceTester.java @@ -1,162 +1,171 @@ package com.alibaba.cloud.integration.common; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.testcontainers.containers.GenericContainer; import org.testcontainers.shaded.com.google.common.collect.Maps; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; +@Getter +@Slf4j +public abstract class RocketmqSourceTester { -@Getter @Slf4j public abstract class RocketmqSourceTester { - - public static final String INSERT = "INSERT"; - - public static final String DELETE = "DELETE"; - - public static final String UPDATE = "UPDATE"; - public static final Set DEBEZIUM_FIELD_SET = new HashSet() {{ - add("before"); - add("after"); - add("source"); - add("op"); - add("ts_ms"); - add("transaction"); - }}; - protected final String sourceType; - protected final Map sourceConfig; - protected int numEntriesToInsert = 1; - protected int numEntriesExpectAfterStart = 9; - - protected RocketmqSourceTester(String sourceType) { - this.sourceType = sourceType; - this.sourceConfig = Maps.newHashMap(); - } - - public abstract void setServiceContainer(ServiceContainerT serviceContainer); - - public String sourceType() { - return sourceType; - } - - public Map sourceConfig() { - return sourceConfig; - } - - public abstract void prepareSource() throws Exception; - - public abstract void prepareInsertEvent() throws Exception; - - public abstract void prepareDeleteEvent() throws Exception; - - public abstract void prepareUpdateEvent() throws Exception; - - public abstract Map produceSourceMessages(int numMessages) - throws Exception; - - public void validateSourceResult(Consumer consumer, int number, String eventType, - String converterClassName) throws Exception { - doPreValidationCheck(eventType); - if (converterClassName.endsWith("AvroConverter")) { - validateSourceResultAvro(consumer, number, eventType); - } - else { - validateSourceResultJson(consumer, number, eventType); - } - doPostValidationCheck(eventType); - } - - /** - * Execute before regular validation to check database-specific state. - */ - public void doPreValidationCheck(String eventType) { - log.info("pre-validation of {}", eventType); - } - - /** - * Execute after regular validation to check database-specific state. - */ - public void doPostValidationCheck(String eventType) { - log.info("post-validation of {}", eventType); - } - - public void validateSourceResultJson(Consumer> consumer, - int number, String eventType) throws Exception { - int recordsNumber = 0; - // Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); - // while(msg != null) { - // recordsNumber ++; - // final String key = new String(msg.getValue().getKey()); - // final String value = new String(msg.getValue().getValue()); - // log.info("Received message: key = {}, value = {}.", key, value); - // Assert.assertTrue(key.contains(this.keyContains())); - // Assert.assertTrue(value.contains(this.valueContains())); - // if (eventType != null) { - // Assert.assertTrue(value.contains(this.eventContains(eventType, true))); - // } - // consumer.acknowledge(msg); - // msg = consumer.receive(1, TimeUnit.SECONDS); - // } - // - // Assert.assertEquals(recordsNumber, number); - // log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); + public static final String INSERT = "INSERT"; + + public static final String DELETE = "DELETE"; + + public static final String UPDATE = "UPDATE"; + public static final Set DEBEZIUM_FIELD_SET = new HashSet() { + { + add("before"); + add("after"); + add("source"); + add("op"); + add("ts_ms"); + add("transaction"); } - - public void validateSourceResultAvro(Consumer> consumer, - int number, String eventType) throws Exception { - int recordsNumber = 0; - // Message> msg = consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); - // while(msg != null) { - // recordsNumber ++; - // K keyRecord = msg.getValue().getKey(); - // Assert.assertNotNull(keyRecord.getFields()); - // Assert.assertTrue(keyRecord.getFields().size() > 0); - // - // V valueRecord = msg.getValue().getValue(); - // Assert.assertNotNull(valueRecord.getFields()); - // Assert.assertTrue(valueRecord.getFields().size() > 0); - // - // log.info("Received message: key = {}, value = {}.", keyRecord.getNativeObject(), valueRecord.getNativeObject()); - // for (Field field : valueRecord.getFields()) { - // log.info("validating field {}", field.getName()); - // Assert.assertTrue(DEBEZIUM_FIELD_SET.contains(field.getName())); - // } - // - // if (eventType != null) { - // String op = valueRecord.getField("op").toString(); - // Assert.assertEquals(this.eventContains(eventType, false), op); - // } - // consumer.acknowledge(msg); - // msg = consumer.receive(1, TimeUnit.SECONDS); - // } - // - // Assert.assertEquals(recordsNumber, number); - // log.info("Stop {} server container. topic: {} has {} records.", getSourceType(), consumer.getTopic(), recordsNumber); + }; + protected final String sourceType; + protected final Map sourceConfig; + protected int numEntriesToInsert = 1; + protected int numEntriesExpectAfterStart = 9; + + protected RocketmqSourceTester(String sourceType) { + this.sourceType = sourceType; + this.sourceConfig = Maps.newHashMap(); + } + + public abstract void setServiceContainer(ServiceContainerT serviceContainer); + + public String sourceType() { + return sourceType; + } + + public Map sourceConfig() { + return sourceConfig; + } + + public abstract void prepareSource() throws Exception; + + public abstract void prepareInsertEvent() throws Exception; + + public abstract void prepareDeleteEvent() throws Exception; + + public abstract void prepareUpdateEvent() throws Exception; + + public abstract Map produceSourceMessages(int numMessages) + throws Exception; + + public void validateSourceResult(Consumer consumer, int number, String eventType, + String converterClassName) throws Exception { + doPreValidationCheck(eventType); + if (converterClassName.endsWith("AvroConverter")) { + validateSourceResultAvro(consumer, number, eventType); } - - public int initialDelayForMsgReceive() { - return 2; + else { + validateSourceResultJson(consumer, number, eventType); } - - public String keyContains() { - return "dbserver1.inventory.products.Key"; + doPostValidationCheck(eventType); + } + + /** + * Execute before regular validation to check database-specific state. + */ + public void doPreValidationCheck(String eventType) { + log.info("pre-validation of {}", eventType); + } + + /** + * Execute after regular validation to check database-specific state. + */ + public void doPostValidationCheck(String eventType) { + log.info("post-validation of {}", eventType); + } + + public void validateSourceResultJson(Consumer> consumer, + int number, String eventType) throws Exception { + int recordsNumber = 0; + // Message> msg = + // consumer.receive(initialDelayForMsgReceive(), TimeUnit.SECONDS); + // while(msg != null) { + // recordsNumber ++; + // final String key = new String(msg.getValue().getKey()); + // final String value = new String(msg.getValue().getValue()); + // log.info("Received message: key = {}, value = {}.", key, value); + // Assert.assertTrue(key.contains(this.keyContains())); + // Assert.assertTrue(value.contains(this.valueContains())); + // if (eventType != null) { + // Assert.assertTrue(value.contains(this.eventContains(eventType, true))); + // } + // consumer.acknowledge(msg); + // msg = consumer.receive(1, TimeUnit.SECONDS); + // } + // + // Assert.assertEquals(recordsNumber, number); + // log.info("Stop {} server container. topic: {} has {} records.", + // getSourceType(), consumer.getTopic(), recordsNumber); + } + + public void validateSourceResultAvro(Consumer> consumer, + int number, String eventType) throws Exception { + int recordsNumber = 0; + // Message> msg = consumer.receive(initialDelayForMsgReceive(), + // TimeUnit.SECONDS); + // while(msg != null) { + // recordsNumber ++; + // K keyRecord = msg.getValue().getKey(); + // Assert.assertNotNull(keyRecord.getFields()); + // Assert.assertTrue(keyRecord.getFields().size() > 0); + // + // V valueRecord = msg.getValue().getValue(); + // Assert.assertNotNull(valueRecord.getFields()); + // Assert.assertTrue(valueRecord.getFields().size() > 0); + // + // log.info("Received message: key = {}, value = {}.", + // keyRecord.getNativeObject(), valueRecord.getNativeObject()); + // for (Field field : valueRecord.getFields()) { + // log.info("validating field {}", field.getName()); + // Assert.assertTrue(DEBEZIUM_FIELD_SET.contains(field.getName())); + // } + // + // if (eventType != null) { + // String op = valueRecord.getField("op").toString(); + // Assert.assertEquals(this.eventContains(eventType, false), op); + // } + // consumer.acknowledge(msg); + // msg = consumer.receive(1, TimeUnit.SECONDS); + // } + // + // Assert.assertEquals(recordsNumber, number); + // log.info("Stop {} server container. topic: {} has {} records.", + // getSourceType(), consumer.getTopic(), recordsNumber); + } + + public int initialDelayForMsgReceive() { + return 2; + } + + public String keyContains() { + return "dbserver1.inventory.products.Key"; + } + + public String valueContains() { + return "dbserver1.inventory.products.Value"; + } + + public String eventContains(String eventType, boolean isJson) { + if (eventType.equals(INSERT)) { + return isJson ? "\"op\":\"c\"" : "c"; } - - public String valueContains() { - return "dbserver1.inventory.products.Value"; + else if (eventType.equals(UPDATE)) { + return isJson ? "\"op\":\"u\"" : "u"; } - - public String eventContains(String eventType, boolean isJson) { - if (eventType.equals(INSERT)) { - return isJson ? "\"op\":\"c\"" : "c"; - } - else if (eventType.equals(UPDATE)) { - return isJson ? "\"op\":\"u\"" : "u"; - } - else { - return isJson ? "\"op\":\"d\"" : "d"; - } + else { + return isJson ? "\"op\":\"d\"" : "d"; } + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java index 8bd79527e9..6926c073f6 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/Schema.java @@ -22,69 +22,76 @@ * Message schema definition. */ public interface Schema extends Cloneable { - - /** - * Check if the message is a valid object for this schema. - * - *

The implementation can choose what its most efficient approach to validate the schema. - * If the implementation doesn't provide it, it will attempt to use {@link #decode(byte[])} - * to see if this schema can decode this message or not as a validation mechanism to verify - * the bytes. - * - * @param message the messages to verify - * @throws SchemaSerializationException if it is not a valid message - */ - default void validate(byte[] message) { - decode(message); - } - - /** - * Encode an object representing the message content into a byte array. - * - * @param message the message object - * @return a byte array with the serialized content - * @throws SchemaSerializationException if the serialization fails - */ - byte[] encode(T message); - - /** - * Returns whether this schema supports versioning. - * - *

Most of the schema implementations don't really support schema versioning, or it just doesn't - * make any sense to support schema versionings (e.g. primitive schemas). Only schema returns - * {@link GenericRecord} should support schema versioning. - * - *

If a schema implementation returns false, it should implement {@link #decode(byte[])}; - * while a schema implementation returns true, it should implement {@link #decode(byte[], byte[])} - * instead. - * - * @return true if this schema implementation supports schema versioning; otherwise returns false. - */ - default boolean supportSchemaVersioning() { - return false; - } - - /** - * Decode a byte array into an object using the schema definition and deserializer implementation. - * - * @param bytes the byte array to decode - * @return the deserialized object - */ - default T decode(byte[] bytes) { - // use `null` to indicate ignoring schema version - return decode(bytes, null); - } - - /** - * Decode a byte array into an object using a given version. - * - * @param bytes the byte array to decode - * @param schemaVersion the schema version to decode the object. null indicates using latest version. - * @return the deserialized object - */ - default T decode(byte[] bytes, byte[] schemaVersion) { - // ignore version by default (most of the primitive schema implementations ignore schema version) - return decode(bytes); - } - + + /** + * Check if the message is a valid object for this schema. + * + *

+ * The implementation can choose what its most efficient approach to validate the + * schema. If the implementation doesn't provide it, it will attempt to use + * {@link #decode(byte[])} to see if this schema can decode this message or not as a + * validation mechanism to verify the bytes. + * + * @param message the messages to verify + * @throws SchemaSerializationException if it is not a valid message + */ + default void validate(byte[] message) { + decode(message); + } + + /** + * Encode an object representing the message content into a byte array. + * + * @param message the message object + * @return a byte array with the serialized content + * @throws SchemaSerializationException if the serialization fails + */ + byte[] encode(T message); + + /** + * Returns whether this schema supports versioning. + * + *

+ * Most of the schema implementations don't really support schema versioning, or it + * just doesn't make any sense to support schema versionings (e.g. primitive schemas). + * Only schema returns {@link GenericRecord} should support schema versioning. + * + *

+ * If a schema implementation returns false, it should implement + * {@link #decode(byte[])}; while a schema implementation returns true, it + * should implement {@link #decode(byte[], byte[])} instead. + * + * @return true if this schema implementation supports schema versioning; otherwise + * returns false. + */ + default boolean supportSchemaVersioning() { + return false; + } + + /** + * Decode a byte array into an object using the schema definition and deserializer + * implementation. + * + * @param bytes the byte array to decode + * @return the deserialized object + */ + default T decode(byte[] bytes) { + // use `null` to indicate ignoring schema version + return decode(bytes, null); + } + + /** + * Decode a byte array into an object using a given version. + * + * @param bytes the byte array to decode + * @param schemaVersion the schema version to decode the object. null indicates using + * latest version. + * @return the deserialized object + */ + default T decode(byte[] bytes, byte[] schemaVersion) { + // ignore version by default (most of the primitive schema implementations ignore + // schema version) + return decode(bytes); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java index 889bf3de5b..03e650ac96 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java @@ -1,12 +1,12 @@ package com.alibaba.cloud.integration.common.nacos; public class Const { - - public static final Integer NACOS_SERVER_PORT = 8848; - public static final String DEFAULT_IMAGE_NAME = System.getenv() - .getOrDefault("TEST_IMAGE_NAME", "nacos-server-test"); - private static final String CONFIG_INSTANCE_PATH = "/nacos/v1/ns"; - public static final String NACOS_SERVER_URL = - "http://127.0.0.1:" + NACOS_SERVER_PORT + CONFIG_INSTANCE_PATH; - + + public static final Integer NACOS_SERVER_PORT = 8848; + public static final String DEFAULT_IMAGE_NAME = System.getenv() + .getOrDefault("TEST_IMAGE_NAME", "nacos-server-test"); + private static final String CONFIG_INSTANCE_PATH = "/nacos/v1/ns"; + public static final String NACOS_SERVER_URL = "http://127.0.0.1:" + NACOS_SERVER_PORT + + CONFIG_INSTANCE_PATH; + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java index d0a4186890..e02c36f2bd 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Params.java @@ -19,21 +19,21 @@ import org.springframework.util.MultiValueMap; public class Params { - - private MultiValueMap paramMap; - - public static Params newParams() { - Params params = new Params(); - params.paramMap = new LinkedMultiValueMap(); - return params; - } - - public Params appendParam(String name, String value) { - this.paramMap.add(name, value); - return this; - } - - public MultiValueMap done() { - return paramMap; - } + + private MultiValueMap paramMap; + + public static Params newParams() { + Params params = new Params(); + params.paramMap = new LinkedMultiValueMap(); + return params; + } + + public Params appendParam(String name, String value) { + this.paramMap.add(name, value); + return this; + } + + public MultiValueMap done() { + return paramMap; + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java index e882efea56..c1fd34e89f 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/TextChangeParser.java @@ -16,38 +16,39 @@ package com.alibaba.cloud.integration.common.nacos; -import com.alibaba.nacos.api.config.ConfigChangeItem; -import com.alibaba.nacos.api.config.PropertyChangeType; -import com.alibaba.nacos.api.config.listener.ConfigChangeParser; - import java.io.IOException; import java.util.HashMap; import java.util.Map; +import com.alibaba.nacos.api.config.ConfigChangeItem; +import com.alibaba.nacos.api.config.PropertyChangeType; +import com.alibaba.nacos.api.config.listener.ConfigChangeParser; + public class TextChangeParser implements ConfigChangeParser { - @Override public boolean isResponsibleFor(String type) { - return (null == type || "text".equalsIgnoreCase(type)); + @Override + public boolean isResponsibleFor(String type) { + return (null == type || "text".equalsIgnoreCase(type)); + } + + @Override + public Map doParse(String oldContent, String newContent, + String type) throws IOException { + Map map = new HashMap<>(4); + final String key = "content"; + + ConfigChangeItem cci = new ConfigChangeItem(key, oldContent, newContent); + if (null == oldContent && null != newContent) { + cci.setType(PropertyChangeType.ADDED); } - - @Override public Map doParse(String oldContent, - String newContent, String type) throws IOException { - Map map = new HashMap<>(4); - final String key = "content"; - - ConfigChangeItem cci = new ConfigChangeItem(key, oldContent, newContent); - if (null == oldContent && null != newContent) { - cci.setType(PropertyChangeType.ADDED); - } - else if (null != oldContent && null != newContent && !oldContent.equals( - newContent)) { - cci.setType(PropertyChangeType.MODIFIED); - } - else if (null != oldContent && null == newContent) { - cci.setType(PropertyChangeType.DELETED); - } - map.put(key, cci); - - return map; + else if (null != oldContent && null != newContent + && !oldContent.equals(newContent)) { + cci.setType(PropertyChangeType.MODIFIED); } -} + else if (null != oldContent && null == newContent) { + cci.setType(PropertyChangeType.DELETED); + } + map.put(key, cci); + return map; + } +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java index e7b5cc541c..010a749b50 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecException.java @@ -19,16 +19,16 @@ package com.alibaba.cloud.integration.docker; public class ContainerExecException extends Exception { - private final ContainerExecResult result; - - public ContainerExecException(String cmd, String containerId, - ContainerExecResult result) { - super(String.format("%s failed on %s with error code %d", cmd, - containerId, result.getExitCode())); - this.result = result; - } - - public ContainerExecResult getResult() { - return result; - } + /** + * + * @param cmd command + * @param containerId container id + * @param result exec result + */ + public ContainerExecException(final String cmd, + final String containerId, final ContainerExecResult result) { + super(String.format("%s failed on %s with error code %d", + cmd, containerId, + result.getExitCode())); + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java index 3d80ca3a6a..ee22ad7ccd 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResult.java @@ -2,26 +2,13 @@ import lombok.Data; -import static org.assertj.core.api.Assertions.assertThat; +@Data(staticConstructor = "of") +public class ContainerExecResult { -@Data(staticConstructor = "of") public class ContainerExecResult { - - private final int exitCode; - private final String stdout; - private final String stderr; - - public void assertNoOutput() { - assertNoStdout(); - assertNoStderr(); - } - - public void assertNoStdout() { - assertThat(stdout.isEmpty()).isEqualTo( - "stdout should be empty, but was '" + stdout + "'"); - } - - public void assertNoStderr() { - assertThat(stdout.isEmpty()).isEqualTo( - "stderr should be empty, but was '" + stderr + "'"); - } -} \ No newline at end of file + /** exception exit code.**/ + private final int exitCode; + /**container log stdout. **/ + private final String stdout; + /**container log stderr output. **/ + private final String stderr; +} diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java index 1c56e9ea7e..1a5a748c6c 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/docker/ContainerExecResultBytes.java @@ -2,10 +2,13 @@ import lombok.Data; -@Data(staticConstructor = "of") public class ContainerExecResultBytes { - - private final int exitCode; - private final byte[] stdout; - private final byte[] stderr; - +@Data(staticConstructor = "of") +public class ContainerExecResultBytes { + + /** exception exit code.**/ + private final int exitCode; + /**container log stdout. **/ + private final byte[] stdout; + /**container log stderr output. **/ + private final byte[] stderr; } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java index 8a31046ae9..0e36f53130 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/utils/DockerUtils.java @@ -18,6 +18,15 @@ */ package com.alibaba.cloud.integration.utils; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.zip.GZIPOutputStream; + import com.alibaba.cloud.integration.docker.ContainerExecException; import com.alibaba.cloud.integration.docker.ContainerExecResult; import com.alibaba.cloud.integration.docker.ContainerExecResultBytes; @@ -35,397 +44,385 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.*; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.zip.GZIPOutputStream; - import static java.nio.charset.StandardCharsets.UTF_8; -public class DockerUtils { - private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class); - - private static File getTargetDirectory(String containerId) { - String base = System.getProperty("maven.buildDirectory"); - if (base == null) { - base = "target"; - } - File directory = new File(base + "/container-logs/" + containerId); - if (!directory.exists() && !directory.mkdirs()) { - LOG.error("Error creating directory for container logs."); - } - return directory; +public final class DockerUtils { + private static final Logger LOG = LoggerFactory.getLogger(DockerUtils.class); + + private DockerUtils() { + + } + + private static File getTargetDirectory(final String containerId) { + String base = System.getProperty("maven.buildDirectory"); + if (base == null) { + base = "target"; } - - public static void dumpContainerLogToTarget(DockerClient dockerClient, - String containerId) { - final String containerName = getContainerName(dockerClient, containerId); - File output = getUniqueFileInTargetDirectory(containerName, "docker", - ".log"); - try (OutputStream os = new BufferedOutputStream( - new FileOutputStream(output))) { - CompletableFuture future = new CompletableFuture<>(); - dockerClient.logContainerCmd(containerName).withStdOut(true) - .withStdErr(true).withTimestamps(true) - .exec(new ResultCallback() { - @Override public void close() { - } - - @Override public void onStart( - Closeable closeable) { - } - - @Override public void onNext(Frame object) { - try { - os.write(object.getPayload()); - } - catch (IOException e) { - onError(e); - } - } - - @Override public void onError( - Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override public void onComplete() { - future.complete(true); - } - }); - future.get(); - } - catch (RuntimeException | ExecutionException | IOException e) { - LOG.error("Error dumping log for {}", containerName, e); - } - catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - LOG.info("Interrupted dumping log from container {}", - containerName, ie); - } + File directory = new File(base + "/container-logs/" + containerId); + if (!directory.exists() && !directory.mkdirs()) { + LOG.error("Error creating directory for container logs."); } - - private static File getUniqueFileInTargetDirectory(String containerName, - String prefix, String suffix) { - return getUniqueFileInDirectory(getTargetDirectory(containerName), prefix, - suffix); + return directory; + } + + public static void dumpContainerLogToTarget(DockerClient dockerClient, + String containerId) { + final String containerName = getContainerName(dockerClient, containerId); + File output = getUniqueFileInTargetDirectory(containerName, "docker", ".log"); + try (OutputStream os = new BufferedOutputStream(new FileOutputStream(output))) { + CompletableFuture future = new CompletableFuture<>(); + dockerClient.logContainerCmd(containerName).withStdOut(true).withStdErr(true) + .withTimestamps(true).exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + } + + @Override + public void onNext(Frame object) { + try { + os.write(object.getPayload()); + } + catch (IOException e) { + onError(e); + } + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + future.complete(true); + } + }); + future.get(); } - - private static File getUniqueFileInDirectory(File directory, String prefix, - String suffix) { - File file = new File(directory, prefix + suffix); - int i = 0; - while (file.exists()) { - LOG.info("{} exists, incrementing", file); - file = new File(directory, prefix + "_" + (i++) + suffix); - } - return file; + catch (RuntimeException | ExecutionException | IOException e) { + LOG.error("Error dumping log for {}", containerName, e); } - - private static String getContainerName(DockerClient dockerClient, - String containerId) { - final InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd( - containerId).exec(); - // docker api returns names prefixed with "/", it's part of it's legacy design, - // this removes it to be consistent with what docker ps shows. - return inspectContainerResponse.getName().replace("/", ""); + catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + LOG.info("Interrupted dumping log from container {}", containerName, ie); } - - public static void dumpContainerDirToTargetCompressed(DockerClient dockerClient, - String containerId, String path) { - final String containerName = getContainerName(dockerClient, containerId); - final String baseName = path.replace("/", "-").replaceAll("^-", ""); - File output = getUniqueFileInTargetDirectory(containerName, baseName, - ".tar.gz"); - try (InputStream dockerStream = dockerClient.copyArchiveFromContainerCmd( - containerId, path).exec(); - OutputStream os = new GZIPOutputStream( - new BufferedOutputStream(new FileOutputStream(output)))) { - IOUtils.copy(dockerStream, os); - } - catch (RuntimeException | IOException e) { - if (!(e instanceof NotFoundException)) { - LOG.error("Error reading dir from container {}", - containerName, e); - } - } + } + + private static File getUniqueFileInTargetDirectory(String containerName, + String prefix, String suffix) { + return getUniqueFileInDirectory(getTargetDirectory(containerName), prefix, + suffix); + } + + private static File getUniqueFileInDirectory(File directory, String prefix, + String suffix) { + File file = new File(directory, prefix + suffix); + int i = 0; + while (file.exists()) { + LOG.info("{} exists, incrementing", file); + file = new File(directory, prefix + "_" + (i++) + suffix); } - - public static void dumpContainerLogDirToTarget(DockerClient docker, - String containerId, String path) { - File targetDirectory = getTargetDirectory(containerId); - try (InputStream dockerStream = docker.copyArchiveFromContainerCmd( - containerId, path).exec(); - TarArchiveInputStream stream = new TarArchiveInputStream( - dockerStream)) { - TarArchiveEntry entry = stream.getNextTarEntry(); - while (entry != null) { - if (entry.isFile()) { - File output = new File(targetDirectory, - entry.getName().replace("/", "-")); - Files.copy(stream, output.toPath(), - StandardCopyOption.REPLACE_EXISTING); - } - entry = stream.getNextTarEntry(); - } - } - catch (RuntimeException | IOException e) { - LOG.error("Error reading logs from container {}", containerId, e); - } + return file; + } + + private static String getContainerName(DockerClient dockerClient, + String containerId) { + final InspectContainerResponse inspectContainerResponse = dockerClient + .inspectContainerCmd(containerId).exec(); + // docker api returns names prefixed with "/", it's part of it's legacy design, + // this removes it to be consistent with what docker ps shows. + return inspectContainerResponse.getName().replace("/", ""); + } + + public static void dumpContainerDirToTargetCompressed(DockerClient dockerClient, + String containerId, String path) { + final String containerName = getContainerName(dockerClient, containerId); + final String baseName = path.replace("/", "-").replaceAll("^-", ""); + File output = getUniqueFileInTargetDirectory(containerName, baseName, ".tar.gz"); + try (InputStream dockerStream = dockerClient + .copyArchiveFromContainerCmd(containerId, path).exec(); + OutputStream os = new GZIPOutputStream( + new BufferedOutputStream(new FileOutputStream(output)))) { + IOUtils.copy(dockerStream, os); } - - public static String getContainerIP(DockerClient docker, String containerId) { - for (Map.Entry e : docker.inspectContainerCmd( - containerId).exec().getNetworkSettings().getNetworks() - .entrySet()) { - return e.getValue().getIpAddress(); - } - throw new IllegalArgumentException( - "Container " + containerId + " has no networks"); + catch (RuntimeException | IOException e) { + if (!(e instanceof NotFoundException)) { + LOG.error("Error reading dir from container {}", containerName, e); + } } - - public static ContainerExecResult runCommand(DockerClient docker, - String containerId, String... cmd) - throws ContainerExecException, ExecutionException, InterruptedException { - try { - return runCommandAsync(docker, containerId, cmd).get(); - } - catch (ExecutionException e) { - if (e.getCause() instanceof ContainerExecException) { - throw (ContainerExecException) e.getCause(); - } - throw e; + } + + public static void dumpContainerLogDirToTarget(DockerClient docker, + String containerId, String path) { + File targetDirectory = getTargetDirectory(containerId); + try (InputStream dockerStream = docker + .copyArchiveFromContainerCmd(containerId, path).exec(); + TarArchiveInputStream stream = new TarArchiveInputStream(dockerStream)) { + TarArchiveEntry entry = stream.getNextTarEntry(); + while (entry != null) { + if (entry.isFile()) { + File output = new File(targetDirectory, + entry.getName().replace("/", "-")); + Files.copy(stream, output.toPath(), + StandardCopyOption.REPLACE_EXISTING); } + entry = stream.getNextTarEntry(); + } } - - public static ContainerExecResult runCommandAsUser(String userId, - DockerClient docker, String containerId, String... cmd) - throws ContainerExecException, ExecutionException, InterruptedException { - try { - return runCommandAsyncAsUser(userId, docker, containerId, - cmd).get(); - } - catch (ExecutionException e) { - if (e.getCause() instanceof ContainerExecException) { - throw (ContainerExecException) e.getCause(); - } - throw e; - } + catch (RuntimeException | IOException e) { + LOG.error("Error reading logs from container {}", containerId, e); } - - public static CompletableFuture runCommandAsyncAsUser( - String userId, DockerClient dockerClient, String containerId, - String... cmd) { - String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) - .withAttachStderr(true).withAttachStdout(true).withUser(userId) - .exec().getId(); - return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + public static String getContainerIP(DockerClient docker, String containerId) { + for (Map.Entry e : docker + .inspectContainerCmd(containerId).exec().getNetworkSettings() + .getNetworks().entrySet()) { + return e.getValue().getIpAddress(); } - - public static CompletableFuture runCommandAsync( - DockerClient dockerClient, String containerId, String... cmd) { - String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) - .withAttachStderr(true).withAttachStdout(true).exec().getId(); - return runCommandAsync(execId, dockerClient, containerId, cmd); + throw new IllegalArgumentException( + "Container " + containerId + " has no networks"); + } + + public static ContainerExecResult runCommand(DockerClient docker, String containerId, + String... cmd) + throws ContainerExecException, ExecutionException, InterruptedException { + try { + return runCommandAsync(docker, containerId, cmd).get(); } - - private static CompletableFuture runCommandAsync( - String execId, DockerClient dockerClient, String containerId, - String... cmd) { - CompletableFuture future = new CompletableFuture<>(); - final String containerName = getContainerName(dockerClient, containerId); - String cmdString = String.join(" ", cmd); - StringBuilder stdout = new StringBuilder(); - StringBuilder stderr = new StringBuilder(); - dockerClient.execStartCmd(execId).withDetach(false) - .exec(new ResultCallback() { - @Override public void close() { - } - - @Override public void onStart(Closeable closeable) { - LOG.info("DOCKER.exec({}:{}): Executing...", - containerName, cmdString); - } - - @Override public void onNext(Frame object) { - LOG.info("DOCKER.exec({}:{}): {}", containerName, - cmdString, object); - if (StreamType.STDOUT == object.getStreamType()) { - stdout.append( - new String(object.getPayload(), - UTF_8)); - } - else if (StreamType.STDERR - == object.getStreamType()) { - stderr.append( - new String(object.getPayload(), - UTF_8)); - } - } - - @Override public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override public void onComplete() { - LOG.info("DOCKER.exec({}:{}): Done", - containerName, cmdString); - - InspectExecResponse resp = waitForExecCmdToFinish( - dockerClient, execId); - int retCode = resp.getExitCode(); - ContainerExecResult result = ContainerExecResult.of( - retCode, stdout.toString(), - stderr.toString()); - LOG.info("DOCKER.exec({}:{}): completed with {}", - containerName, cmdString, retCode); - - if (retCode != 0) { - LOG.error( - "DOCKER.exec({}:{}): completed with non zero return code: {}\nstdout: {}\nstderr:" - + " {}", containerName, - cmdString, result.getExitCode(), - result.getStdout(), - result.getStderr()); - future.completeExceptionally( - new ContainerExecException( - cmdString, containerId, - result)); - } - else { - future.complete(result); - } - } - }); - return future; + catch (ExecutionException e) { + if (e.getCause() instanceof ContainerExecException) { + throw (ContainerExecException) e.getCause(); + } + throw e; } - - public static ContainerExecResultBytes runCommandWithRawOutput( - DockerClient dockerClient, String containerId, String... cmd) - throws ContainerExecException { - CompletableFuture future = new CompletableFuture<>(); - String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) - .withAttachStderr(true).withAttachStdout(true).exec().getId(); - final String containerName = getContainerName(dockerClient, containerId); - String cmdString = String.join(" ", cmd); - ByteArrayOutputStream stdout = new ByteArrayOutputStream(); - ByteArrayOutputStream stderr = new ByteArrayOutputStream(); - dockerClient.execStartCmd(execId).withDetach(false) - .exec(new ResultCallback() { - @Override public void close() { - } - - @Override public void onStart(Closeable closeable) { - LOG.info("DOCKER.exec({}:{}): Executing...", - containerName, cmdString); - } - - @Override public void onNext(Frame object) { - try { - if (StreamType.STDOUT - == object.getStreamType()) { - stdout.write(object.getPayload()); - } - else if (StreamType.STDERR - == object.getStreamType()) { - stderr.write(object.getPayload()); - } - } - catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - @Override public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override public void onComplete() { - LOG.info("DOCKER.exec({}:{}): Done", - containerName, cmdString); - future.complete(true); - } - }); - future.join(); - - InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); - int retCode = resp.getExitCode(); - - ContainerExecResultBytes result = ContainerExecResultBytes.of(retCode, - stdout.toByteArray(), stderr.toByteArray()); - LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, - cmdString, retCode); - - if (retCode != 0) { - throw new ContainerExecException(cmdString, containerId, null); - } - return result; + } + + public static ContainerExecResult runCommandAsUser(String userId, DockerClient docker, + String containerId, String... cmd) + throws ContainerExecException, ExecutionException, InterruptedException { + try { + return runCommandAsyncAsUser(userId, docker, containerId, cmd).get(); } - - public static CompletableFuture runCommandAsyncWithLogging( - DockerClient dockerClient, String containerId, String... cmd) { - CompletableFuture future = new CompletableFuture<>(); - String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) - .withAttachStderr(true).withAttachStdout(true).exec().getId(); - final String containerName = getContainerName(dockerClient, containerId); - String cmdString = String.join(" ", cmd); - dockerClient.execStartCmd(execId).withDetach(false) - .exec(new ResultCallback() { - @Override public void close() { - } - - @Override public void onStart(Closeable closeable) { - LOG.info("DOCKER.exec({}:{}): Executing...", - containerName, cmdString); - } - - @Override public void onNext(Frame object) { - LOG.info("DOCKER.exec({}:{}): {}", containerName, - cmdString, object); - } - - @Override public void onError(Throwable throwable) { - future.completeExceptionally(throwable); - } - - @Override public void onComplete() { - LOG.info("DOCKER.exec({}:{}): Done", - containerName, cmdString); - InspectExecResponse resp = waitForExecCmdToFinish( - dockerClient, execId); - int retCode = resp.getExitCode(); - LOG.info("DOCKER.exec({}:{}): completed with {}", - containerName, cmdString, retCode); - future.complete(retCode); - } - }); - return future; + catch (ExecutionException e) { + if (e.getCause() instanceof ContainerExecException) { + throw (ContainerExecException) e.getCause(); + } + throw e; } - - private static InspectExecResponse waitForExecCmdToFinish( - DockerClient dockerClient, String execId) { - InspectExecResponse resp = dockerClient.inspectExecCmd(execId).exec(); - while (resp.isRunning()) { + } + + public static CompletableFuture runCommandAsyncAsUser( + String userId, DockerClient dockerClient, String containerId, String... cmd) { + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).withUser(userId).exec() + .getId(); + return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + public static CompletableFuture runCommandAsync( + DockerClient dockerClient, String containerId, String... cmd) { + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).exec().getId(); + return runCommandAsync(execId, dockerClient, containerId, cmd); + } + + private static CompletableFuture runCommandAsync(String execId, + DockerClient dockerClient, String containerId, String... cmd) { + CompletableFuture future = new CompletableFuture<>(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + StringBuilder stdout = new StringBuilder(); + StringBuilder stderr = new StringBuilder(); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", containerName, + cmdString); + } + + @Override + public void onNext(Frame object) { + LOG.info("DOCKER.exec({}:{}): {}", containerName, cmdString, + object); + if (StreamType.STDOUT == object.getStreamType()) { + stdout.append(new String(object.getPayload(), UTF_8)); + } + else if (StreamType.STDERR == object.getStreamType()) { + stderr.append(new String(object.getPayload(), UTF_8)); + } + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); + + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, + execId); + int retCode = resp.getExitCode(); + ContainerExecResult result = ContainerExecResult.of(retCode, + stdout.toString(), stderr.toString()); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, + cmdString, retCode); + + if (retCode != 0) { + LOG.error( + "DOCKER.exec({}:{}): completed with non zero return code: {}\nstdout: {}\nstderr:" + + " {}", + containerName, cmdString, result.getExitCode(), + result.getStdout(), result.getStderr()); + future.completeExceptionally(new ContainerExecException( + cmdString, containerId, result)); + } + else { + future.complete(result); + } + } + }); + return future; + } + + public static ContainerExecResultBytes runCommandWithRawOutput( + DockerClient dockerClient, String containerId, String... cmd) + throws ContainerExecException { + CompletableFuture future = new CompletableFuture<>(); + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).exec().getId(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + ByteArrayOutputStream stdout = new ByteArrayOutputStream(); + ByteArrayOutputStream stderr = new ByteArrayOutputStream(); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", containerName, + cmdString); + } + + @Override + public void onNext(Frame object) { try { - Thread.sleep(200); + if (StreamType.STDOUT == object.getStreamType()) { + stdout.write(object.getPayload()); + } + else if (StreamType.STDERR == object.getStreamType()) { + stderr.write(object.getPayload()); + } } - catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - throw new RuntimeException(ie); + catch (IOException e) { + throw new UncheckedIOException(e); } - resp = dockerClient.inspectExecCmd(execId).exec(); - } - return resp; + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); + future.complete(true); + } + }); + future.join(); + + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, execId); + int retCode = resp.getExitCode(); + + ContainerExecResultBytes result = ContainerExecResultBytes.of(retCode, + stdout.toByteArray(), stderr.toByteArray()); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, cmdString, + retCode); + + if (retCode != 0) { + throw new ContainerExecException(cmdString, containerId, null); } - - public static Optional getContainerCluster(DockerClient docker, - String containerId) { - return Optional.ofNullable( - docker.inspectContainerCmd(containerId).exec().getConfig() - .getLabels().get("cluster")); + return result; + } + + public static CompletableFuture runCommandAsyncWithLogging( + DockerClient dockerClient, String containerId, String... cmd) { + CompletableFuture future = new CompletableFuture<>(); + String execId = dockerClient.execCreateCmd(containerId).withCmd(cmd) + .withAttachStderr(true).withAttachStdout(true).exec().getId(); + final String containerName = getContainerName(dockerClient, containerId); + String cmdString = String.join(" ", cmd); + dockerClient.execStartCmd(execId).withDetach(false) + .exec(new ResultCallback() { + @Override + public void close() { + } + + @Override + public void onStart(Closeable closeable) { + LOG.info("DOCKER.exec({}:{}): Executing...", containerName, + cmdString); + } + + @Override + public void onNext(Frame object) { + LOG.info("DOCKER.exec({}:{}): {}", containerName, cmdString, + object); + } + + @Override + public void onError(Throwable throwable) { + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + LOG.info("DOCKER.exec({}:{}): Done", containerName, cmdString); + InspectExecResponse resp = waitForExecCmdToFinish(dockerClient, + execId); + int retCode = resp.getExitCode(); + LOG.info("DOCKER.exec({}:{}): completed with {}", containerName, + cmdString, retCode); + future.complete(retCode); + } + }); + return future; + } + + private static InspectExecResponse waitForExecCmdToFinish(DockerClient dockerClient, + String execId) { + InspectExecResponse resp = dockerClient.inspectExecCmd(execId).exec(); + while (resp.isRunning()) { + try { + Thread.sleep(200); + } + catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + throw new RuntimeException(ie); + } + resp = dockerClient.inspectExecCmd(execId).exec(); } + return resp; + } + + public static Optional getContainerCluster(DockerClient docker, + String containerId) { + return Optional.ofNullable(docker.inspectContainerCmd(containerId).exec() + .getConfig().getLabels().get("cluster")); + } } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java index 4c8364be94..cc112304c2 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java @@ -7,31 +7,24 @@ public class NacosContainer> extends ChaosContainer { - - public static final String DEFAULT_IMAGE_NAME = System.getenv() - .getOrDefault("TEST_IMAGE_NAME", "nacos"); - - public NacosContainer(String clusterName, String image) { - super(clusterName, image); - withExposedPorts(NACOS_SERVER_PORT).withCommand( - format("/bin/bash -c ' cmd.withHostConfig( - // new HostConfig() - // .withPortBindings(new PortBinding(Ports.Binding.bindPort(8849), new ExposedPort(NACOS_SERVER_PORT)))));; - - } - - @Override protected void configure() { - super.configure(); - this.withNetworkAliases(DEFAULT_IMAGE_NAME) - .withExposedPorts(NACOS_SERVER_PORT) - .withCreateContainerCmdModifier(createContainerCmd -> { - createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); - createContainerCmd.withName( - clusterName + "-" + DEFAULT_IMAGE_NAME); - }); - } - + + public static final String DEFAULT_IMAGE_NAME = System.getenv() + .getOrDefault("TEST_IMAGE_NAME", "nacos"); + + public NacosContainer(String clusterName, String image) { + super(clusterName, image); + withExposedPorts(NACOS_SERVER_PORT).withCommand( + format("/bin/bash -c ' { + createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); + createContainerCmd.withName(clusterName + "-" + DEFAULT_IMAGE_NAME); + }); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java index eef2cbef10..700ae6d698 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java @@ -10,51 +10,55 @@ import org.junit.Before; import org.junit.Test; -@Slf4j public class NacosContainerTest extends NacosBootTester { - - private static final String image = "freemanlau/nacos:1.4.2"; - private NacosContainer nacosContainer; - - @Override public void vaildateUpdateState(NacosConfig nacosConfig, - NacosConfigProperties properties, UserProperties userProperties) - throws NacosException { - super.vaildateUpdateState(nacosConfig, properties, userProperties); - } - - @Override protected String uploadFile(UserProperties userProperties) { - - try { - - String content = "configdata:\n" + " user:\n" + " age: 22\n" - + " name: freeman1123\n" + " map:\n" - + " hobbies:\n" + " - art\n" - + " - programming\n" + " - movie\n" - + " intro: Hello, I'm freeman\n" - + " extra: yo~\n" + " users:\n" - + " - name: dad\n" + " age: 20\n" - + " - name: mom\n" + " age: 18"; - return content; - } - catch (Exception ex) { - log.error("Nacos pulish failed"); - return null; - } - } - - @Before public void setUp() throws Exception { - nacosContainer = new NacosContainer("nacos-example", image); - nacosContainer.start(); - } - - @After public void cleanup() throws Exception { - +@Slf4j +public class NacosContainerTest extends NacosBootTester { + + private static final String image = "freemanlau/nacos:1.4.2"; + private NacosContainer nacosContainer; + + @Override + public void vaildateUpdateState(NacosConfig nacosConfig, + NacosConfigProperties properties, UserProperties userProperties) + throws NacosException { + super.vaildateUpdateState(nacosConfig, properties, userProperties); + } + + @Override + protected String uploadFile(UserProperties userProperties) { + + try { + + String content = "configdata:\n" + " user:\n" + " age: 22\n" + + " name: freeman1123\n" + " map:\n" + " hobbies:\n" + + " - art\n" + " - programming\n" + " - movie\n" + + " intro: Hello, I'm freeman\n" + " extra: yo~\n" + + " users:\n" + " - name: dad\n" + " age: 20\n" + + " - name: mom\n" + " age: 18"; + return content; } - - @Test public void testNacosStartUp() throws Exception { - NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); - UserProperties userProperties = new UserProperties(); - NacosConfig nacosConfig = NacosConfig.builder().build(); - vaildateUpdateState(nacosConfig, nacosConfigProperties, userProperties); + catch (Exception ex) { + log.error("Nacos pulish failed"); + return null; } - + } + + @Before + public void setUp() throws Exception { + nacosContainer = new NacosContainer("nacos-example", image); + nacosContainer.start(); + } + + @After + public void cleanup() throws Exception { + + } + + @Test + public void testNacosStartUp() throws Exception { + NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); + UserProperties userProperties = new UserProperties(); + NacosConfig nacosConfig = NacosConfig.builder().build(); + vaildateUpdateState(nacosConfig, nacosConfigProperties, userProperties); + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java index 4b228e8585..0705e1767a 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java @@ -16,6 +16,9 @@ package com.alibaba.cloud.integration.test.nacos.common; +import java.util.HashMap; +import java.util.Map; + import com.alibaba.cloud.integration.test.nacos.NacosContainer; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.common.http.Callback; @@ -30,126 +33,130 @@ import org.junit.Test; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.Map; - import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_URL; public class NacosAsyncRestTemplateITCase { - - private static final String image = "nacos/nacos-server:latest"; - private final NacosAsyncRestTemplate nacosRestTemplate = HttpClientBeanHolder.getNacosAsyncRestTemplate( - LoggerFactory.getLogger(NacosAsyncRestTemplateITCase.class)); - private NacosContainer nacosContainer; - - @Before public void setUp() throws NacosException { - nacosContainer = new NacosContainer("nacos-example", image); - nacosContainer.start(); - } - - @Test public void test_url_post_form() throws Exception { - - String url = NACOS_SERVER_URL + "/instance"; - Map param = new HashMap<>(); - param.put("serviceName", "app-test"); - param.put("port", "8080"); - param.put("ip", "127.0.0.1"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), - param, String.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - } - - @Test public void test_url_put_form() throws Exception { - String url = NACOS_SERVER_URL + "/instance"; - Map param = new HashMap<>(); - param.put("serviceName", "app-test-change"); - param.put("port", "8080"); - param.put("ip", "11.11.11.11"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), - param, String.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); + + private static final String image = "nacos/nacos-server:latest"; + private final NacosAsyncRestTemplate nacosRestTemplate = HttpClientBeanHolder + .getNacosAsyncRestTemplate( + LoggerFactory.getLogger(NacosAsyncRestTemplateITCase.class)); + private NacosContainer nacosContainer; + + @Before + public void setUp() throws NacosException { + nacosContainer = new NacosContainer("nacos-example", image); + nacosContainer.start(); + } + + @Test + public void test_url_post_form() throws Exception { + + String url = NACOS_SERVER_URL + "/instance"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test"); + param.put("port", "8080"); + param.put("ip", "127.0.0.1"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, + String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + @Test + public void test_url_put_form() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test-change"); + param.put("port", "8080"); + param.put("ip", "11.11.11.11"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.postForm(url, Header.newInstance(), Query.newInstance(), param, + String.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + @Test + public void test_url_get() throws Exception { + String url = NACOS_SERVER_URL + "/instance/list"; + Query query = Query.newInstance().addParam("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.get(url, Header.newInstance(), query, Map.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + Assert.assertEquals(restResult.getData().get("name"), "DEFAULT_GROUP@@app-test"); + } + + @Test + public void test_url_by_map() throws Exception { + String url = NACOS_SERVER_URL + "/instance/list"; + Map param = new HashMap<>(); + param.put("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.get(url, Header.newInstance(), + Query.newInstance().initParams(param), Map.class, callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + Assert.assertEquals(restResult.getData().get("name"), "DEFAULT_GROUP@@app-test"); + } + + @Test + public void test_url_delete() throws Exception { + String url = NACOS_SERVER_URL + "/instance"; + Query query = Query.newInstance().addParam("ip", "11.11.11.11") + .addParam("port", "8080").addParam("serviceName", "app-test"); + CallbackMap callbackMap = new CallbackMap<>(); + nacosRestTemplate.delete(url, Header.newInstance(), query, String.class, + callbackMap); + Thread.sleep(2000); + HttpRestResult restResult = callbackMap.getRestResult(); + System.out.println(restResult.getData()); + System.out.println(restResult.getHeader()); + Assert.assertTrue(restResult.ok()); + } + + private class CallbackMap implements Callback { + + private HttpRestResult restResult; + + private Throwable throwable; + + @Override + public void onReceive(RestResult result) { + restResult = (HttpRestResult) result; } - - @Test public void test_url_get() throws Exception { - String url = NACOS_SERVER_URL + "/instance/list"; - Query query = Query.newInstance().addParam("serviceName", "app-test"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.get(url, Header.newInstance(), query, Map.class, - callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - Assert.assertEquals(restResult.getData().get("name"), - "DEFAULT_GROUP@@app-test"); + + @Override + public void onError(Throwable throwable) { + this.throwable = throwable; } - - @Test public void test_url_by_map() throws Exception { - String url = NACOS_SERVER_URL + "/instance/list"; - Map param = new HashMap<>(); - param.put("serviceName", "app-test"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.get(url, Header.newInstance(), - Query.newInstance().initParams(param), Map.class, callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); - Assert.assertEquals(restResult.getData().get("name"), - "DEFAULT_GROUP@@app-test"); + + @Override + public void onCancel() { + } - - @Test public void test_url_delete() throws Exception { - String url = NACOS_SERVER_URL + "/instance"; - Query query = Query.newInstance().addParam("ip", "11.11.11.11") - .addParam("port", "8080").addParam("serviceName", "app-test"); - CallbackMap callbackMap = new CallbackMap<>(); - nacosRestTemplate.delete(url, Header.newInstance(), query, String.class, - callbackMap); - Thread.sleep(2000); - HttpRestResult restResult = callbackMap.getRestResult(); - System.out.println(restResult.getData()); - System.out.println(restResult.getHeader()); - Assert.assertTrue(restResult.ok()); + + public HttpRestResult getRestResult() { + return restResult; } - - private class CallbackMap implements Callback { - - private HttpRestResult restResult; - - private Throwable throwable; - - @Override public void onReceive(RestResult result) { - restResult = (HttpRestResult) result; - } - - @Override public void onError(Throwable throwable) { - this.throwable = throwable; - } - - @Override public void onCancel() { - - } - - public HttpRestResult getRestResult() { - return restResult; - } - - public Throwable getThrowable() { - return throwable; - } + + public Throwable getThrowable() { + return throwable; } - + } + } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java index b60f0db030..84aff5d9d1 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/core/HttpClient4Test.java @@ -1,5 +1,7 @@ package com.alibaba.cloud.integration.test.nacos.core; +import java.net.URL; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; @@ -9,41 +11,39 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; -import java.net.URL; - public class HttpClient4Test { - - protected URL baseURL; - - @Autowired protected TestRestTemplate restTemplate; - - protected ResponseEntity request(String path, - MultiValueMap params, Class clazz) { - - HttpHeaders headers = new HttpHeaders(); - - HttpEntity entity = new HttpEntity(headers); - - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl( - this.baseURL.toString() + path).queryParams(params); - - return this.restTemplate.exchange(builder.toUriString(), HttpMethod.GET, - entity, clazz); - } - - protected ResponseEntity request(String path, - MultiValueMap params, Class clazz, - HttpMethod httpMethod) { - - HttpHeaders headers = new HttpHeaders(); - - HttpEntity entity = new HttpEntity(headers); - - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl( - this.baseURL.toString() + path).queryParams(params); - - return this.restTemplate.exchange(builder.toUriString(), httpMethod, - entity, clazz); - } - + + protected URL baseURL; + + @Autowired + protected TestRestTemplate restTemplate; + + protected ResponseEntity request(String path, + MultiValueMap params, Class clazz) { + + HttpHeaders headers = new HttpHeaders(); + + HttpEntity entity = new HttpEntity(headers); + + UriComponentsBuilder builder = UriComponentsBuilder + .fromHttpUrl(this.baseURL.toString() + path).queryParams(params); + + return this.restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, + clazz); + } + + protected ResponseEntity request(String path, + MultiValueMap params, Class clazz, HttpMethod httpMethod) { + + HttpHeaders headers = new HttpHeaders(); + + HttpEntity entity = new HttpEntity(headers); + + UriComponentsBuilder builder = UriComponentsBuilder + .fromHttpUrl(this.baseURL.toString() + path).queryParams(params); + + return this.restTemplate.exchange(builder.toUriString(), httpMethod, entity, + clazz); + } + } \ No newline at end of file diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java index be6bf2abdb..e654d1452d 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/rocketmq/RocketmqContainer.java @@ -1,5 +1,9 @@ package com.alibaba.cloud.integration.test.rocketmq; +import java.time.Duration; +import java.util.Objects; +import java.util.UUID; + import com.alibaba.cloud.integration.common.ChaosContainer; import com.alibaba.cloud.integration.utils.DockerUtils; import lombok.extern.slf4j.Slf4j; @@ -7,151 +11,152 @@ import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; -import java.time.Duration; -import java.util.Objects; -import java.util.UUID; - import static java.time.temporal.ChronoUnit.SECONDS; -@Slf4j public abstract class RocketmqContainer> +@Slf4j +public abstract class RocketmqContainer> extends ChaosContainer { - - public static final int INVALID_PORT = -1; - public static final int ZK_PORT = 2181; - public static final int CS_PORT = 2184; - public static final int BOOKIE_PORT = 3181; - public static final int BROKER_PORT = 6650; - public static final int BROKER_HTTP_PORT = 8080; - - public static final String DEFAULT_IMAGE_NAME = System.getenv() - .getOrDefault("TEST_IMAGE_NAME", ""); - - /** - * For debugging purposes, it is useful to have the ability to leave containers running. - * This mode can be activated by setting environment variables - * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true - * After debugging, one can use this command to kill all containers that were left running: - * docker kill $(docker ps -q --filter "label=markcontainer=true") - */ - public static final boolean CONTAINERS_LEAVE_RUNNING = Boolean.parseBoolean( - System.getenv("CONTAINERS_LEAVE_RUNNING")); - - private final String hostname; - private final String serviceName; - private final String serviceEntryPoint; - private final int servicePort; - private final int httpPort; - private final String httpPath; - - public RocketmqContainer(String clusterName, String hostname, String serviceName, - String serviceEntryPoint, int servicePort, int httpPort) { - this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, - httpPort, "/metrics"); - } - - public RocketmqContainer(String clusterName, String hostname, String serviceName, - String serviceEntryPoint, int servicePort, int httpPort, - String httpPath) { - this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, - httpPort, httpPath, DEFAULT_IMAGE_NAME); - } - - public RocketmqContainer(String clusterName, String hostname, String serviceName, - String serviceEntryPoint, int servicePort, int httpPort, String httpPath, - String pulsarImageName) { - super(clusterName, pulsarImageName); - this.hostname = hostname; - this.serviceName = serviceName; - this.serviceEntryPoint = serviceEntryPoint; - this.servicePort = servicePort; - this.httpPort = httpPort; - this.httpPath = httpPath; - - configureLeaveContainerRunning(this); - } - - public static void configureLeaveContainerRunning(GenericContainer container) { - if (CONTAINERS_LEAVE_RUNNING) { - // use Testcontainers reuse containers feature to leave the container running - container.withReuse(true); - // add label that can be used to find containers that are left running. - container.withLabel("markcontainer", "true"); - // add a random label to prevent reuse of containers - container.withLabel("markcontainer.random", - UUID.randomUUID().toString()); - } - } - - @Override protected void beforeStop() { - super.beforeStop(); - if (null != getContainerId()) { - DockerUtils.dumpContainerDirToTargetCompressed(getDockerClient(), - getContainerId(), "/var/log/pulsar"); - } - } - - @Override public void stop() { - if (CONTAINERS_LEAVE_RUNNING) { - log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); - return; - } - super.stop(); + + public static final int INVALID_PORT = -1; + public static final int ZK_PORT = 2181; + public static final int CS_PORT = 2184; + public static final int BOOKIE_PORT = 3181; + public static final int BROKER_PORT = 6650; + public static final int BROKER_HTTP_PORT = 8080; + + public static final String DEFAULT_IMAGE_NAME = System.getenv() + .getOrDefault("TEST_IMAGE_NAME", ""); + + /** + * For debugging purposes, it is useful to have the ability to leave containers + * running. This mode can be activated by setting environment variables + * CONTAINERS_LEAVE_RUNNING=true and TESTCONTAINERS_REUSE_ENABLE=true After debugging, + * one can use this command to kill all containers that were left running: docker kill + * $(docker ps -q --filter "label=markcontainer=true") + */ + public static final boolean CONTAINERS_LEAVE_RUNNING = Boolean + .parseBoolean(System.getenv("CONTAINERS_LEAVE_RUNNING")); + + private final String hostname; + private final String serviceName; + private final String serviceEntryPoint; + private final int servicePort; + private final int httpPort; + private final String httpPath; + + public RocketmqContainer(String clusterName, String hostname, String serviceName, + String serviceEntryPoint, int servicePort, int httpPort) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, + "/metrics"); + } + + public RocketmqContainer(String clusterName, String hostname, String serviceName, + String serviceEntryPoint, int servicePort, int httpPort, String httpPath) { + this(clusterName, hostname, serviceName, serviceEntryPoint, servicePort, httpPort, + httpPath, DEFAULT_IMAGE_NAME); + } + + public RocketmqContainer(String clusterName, String hostname, String serviceName, + String serviceEntryPoint, int servicePort, int httpPort, String httpPath, + String pulsarImageName) { + super(clusterName, pulsarImageName); + this.hostname = hostname; + this.serviceName = serviceName; + this.serviceEntryPoint = serviceEntryPoint; + this.servicePort = servicePort; + this.httpPort = httpPort; + this.httpPath = httpPath; + + configureLeaveContainerRunning(this); + } + + public static void configureLeaveContainerRunning(GenericContainer container) { + if (CONTAINERS_LEAVE_RUNNING) { + // use Testcontainers reuse containers feature to leave the container running + container.withReuse(true); + // add label that can be used to find containers that are left running. + container.withLabel("markcontainer", "true"); + // add a random label to prevent reuse of containers + container.withLabel("markcontainer.random", UUID.randomUUID().toString()); } - - @Override public String getContainerName() { - return clusterName + "-" + hostname; + } + + @Override + protected void beforeStop() { + super.beforeStop(); + if (null != getContainerId()) { + DockerUtils.dumpContainerDirToTargetCompressed(getDockerClient(), + getContainerId(), "/var/log/pulsar"); } - - @Override protected void configure() { - super.configure(); - if (httpPort > 0) { - addExposedPorts(httpPort); - } - if (servicePort > 0) { - addExposedPort(servicePort); - } + } + + @Override + public void stop() { + if (CONTAINERS_LEAVE_RUNNING) { + log.warn("Ignoring stop due to CONTAINERS_LEAVE_RUNNING=true."); + return; } - - protected void beforeStart() { + super.stop(); + } + + @Override + public String getContainerName() { + return clusterName + "-" + hostname; + } + + @Override + protected void configure() { + super.configure(); + if (httpPort > 0) { + addExposedPorts(httpPort); } - - protected void afterStart() { + if (servicePort > 0) { + addExposedPort(servicePort); } - - @Override public void start() { - if (httpPort > 0 && servicePort < 0) { - this.waitStrategy = new HttpWaitStrategy().forPort(httpPort) - .forStatusCode(200).forPath(httpPath) - .withStartupTimeout(Duration.of(300, SECONDS)); - } - else if (httpPort > 0 || servicePort > 0) { - this.waitStrategy = new HostPortWaitStrategy().withStartupTimeout( - Duration.of(300, SECONDS)); - } - this.withCreateContainerCmdModifier(createContainerCmd -> { - createContainerCmd.withHostName(hostname); - createContainerCmd.withName(getContainerName()); - createContainerCmd.withEntrypoint(serviceEntryPoint); - }); - - beforeStart(); - super.start(); - afterStart(); - log.info("[{}] Start pulsar service {} at container {}", - getContainerName(), serviceName, getContainerId()); + } + + protected void beforeStart() { + } + + protected void afterStart() { + } + + @Override + public void start() { + if (httpPort > 0 && servicePort < 0) { + this.waitStrategy = new HttpWaitStrategy().forPort(httpPort) + .forStatusCode(200).forPath(httpPath) + .withStartupTimeout(Duration.of(300, SECONDS)); } - - @Override public boolean equals(Object o) { - if (!(o instanceof RocketmqContainer)) { - return false; - } - - RocketmqContainer another = (RocketmqContainer) o; - return getContainerId().equals(another.getContainerId()) && super.equals( - another); + else if (httpPort > 0 || servicePort > 0) { + this.waitStrategy = new HostPortWaitStrategy() + .withStartupTimeout(Duration.of(300, SECONDS)); } - - @Override public int hashCode() { - return 31 * super.hashCode() + Objects.hash(getContainerId()); + this.withCreateContainerCmdModifier(createContainerCmd -> { + createContainerCmd.withHostName(hostname); + createContainerCmd.withName(getContainerName()); + createContainerCmd.withEntrypoint(serviceEntryPoint); + }); + + beforeStart(); + super.start(); + afterStart(); + log.info("[{}] Start pulsar service {} at container {}", getContainerName(), + serviceName, getContainerId()); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof RocketmqContainer)) { + return false; } + + RocketmqContainer another = (RocketmqContainer) o; + return getContainerId().equals(another.getContainerId()) && super.equals(another); + } + + @Override + public int hashCode() { + return 31 * super.hashCode() + Objects.hash(getContainerId()); + } } From 3738832c5499662800319b5a35c30625d28047cd Mon Sep 17 00:00:00 2001 From: windwheel Date: Fri, 29 Jul 2022 12:08:32 +0800 Subject: [PATCH 26/26] fix NacosAsyncRestTemplateITCase startup error --- .../pom.xml | 2 +- .../cloud/integration/common/nacos/Const.java | 1 + .../test/nacos/NacosContainer.java | 24 ++++++++++++++++--- .../test/nacos/NacosContainerTest.java | 1 + .../common/NacosAsyncRestTemplateITCase.java | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml index 90090a2211..08c9530f2e 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/pom.xml @@ -15,7 +15,7 @@ 1.7.25 - 1.16.3 + 1.17.3 diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java index 03e650ac96..dec95c3cf7 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/main/java/com/alibaba/cloud/integration/common/nacos/Const.java @@ -3,6 +3,7 @@ public class Const { public static final Integer NACOS_SERVER_PORT = 8848; + public static final Integer LOCAL_SERVER_PORT = 8849; public static final String DEFAULT_IMAGE_NAME = System.getenv() .getOrDefault("TEST_IMAGE_NAME", "nacos-server-test"); private static final String CONFIG_INSTANCE_PATH = "/nacos/v1/ns"; diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java index cc112304c2..25b81721ef 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainer.java @@ -1,7 +1,15 @@ package com.alibaba.cloud.integration.test.nacos; import com.alibaba.cloud.integration.common.ChaosContainer; +import com.github.dockerjava.api.model.ExposedPort; +import com.github.dockerjava.api.model.HostConfig; +import com.github.dockerjava.api.model.PortBinding; +import com.github.dockerjava.api.model.Ports; +import java.util.HashMap; +import java.util.Map; + +import static com.alibaba.cloud.integration.common.nacos.Const.LOCAL_SERVER_PORT; import static com.alibaba.cloud.integration.common.nacos.Const.NACOS_SERVER_PORT; import static java.lang.String.format; @@ -13,17 +21,27 @@ public class NacosContainer> public NacosContainer(String clusterName, String image) { super(clusterName, image); - withExposedPorts(NACOS_SERVER_PORT).withCommand( - format("/bin/bash -c ' envKey = new HashMap<>(); + envKey.put("MODE", "standalone"); + withEnv(envKey) + .withCommand( + format("/bin/bash -c ' { createContainerCmd.withHostName(DEFAULT_IMAGE_NAME); createContainerCmd.withName(clusterName + "-" + DEFAULT_IMAGE_NAME); + createContainerCmd.withHostConfig(new HostConfig().withPortBindings( + new PortBinding(Ports.Binding.bindPort(NACOS_SERVER_PORT), new ExposedPort(LOCAL_SERVER_PORT)))); }); } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java index 700ae6d698..4d7a7fd340 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/NacosContainerTest.java @@ -57,6 +57,7 @@ public void cleanup() throws Exception { public void testNacosStartUp() throws Exception { NacosConfigProperties nacosConfigProperties = new NacosConfigProperties(); UserProperties userProperties = new UserProperties(); + NacosConfig nacosConfig = NacosConfig.builder().build(); vaildateUpdateState(nacosConfig, nacosConfigProperties, userProperties); } diff --git a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java index 0705e1767a..52fe33008d 100644 --- a/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java +++ b/spring-cloud-alibaba-tests/spring-cloud-alibaba-testcontainers/src/test/java/com/alibaba/cloud/integration/test/nacos/common/NacosAsyncRestTemplateITCase.java @@ -37,7 +37,7 @@ public class NacosAsyncRestTemplateITCase { - private static final String image = "nacos/nacos-server:latest"; + private static final String image = "nacos/nacos-server:2.0.2"; private final NacosAsyncRestTemplate nacosRestTemplate = HttpClientBeanHolder .getNacosAsyncRestTemplate( LoggerFactory.getLogger(NacosAsyncRestTemplateITCase.class));