This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch refactor/kubernetes
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/refactor/kubernetes by this
push:
new 58ddd6c2 [OSPP] Unified test platform based on Kubernetes (#991)
58ddd6c2 is described below
commit 58ddd6c23a9d6c82bed851ba782b4f6ff162005a
Author: Phix <[email protected]>
AuthorDate: Tue Oct 31 11:16:00 2023 +0800
[OSPP] Unified test platform based on Kubernetes (#991)
---
.github/workflows/dubbo-3_2.yml | 10 +
.github/workflows/dubbo-3_3.yml | 10 +
.github/workflows/nightly-dubbo-3.yml | 2 +
.gitignore | 1 -
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../dubbo-samples-autowire/case-configuration.yml | 5 +
.../dubbo-samples-cache/case-configuration.yml | 3 +
.../dubbo-samples-callback/case-configuration.yml | 5 +
.../dubbo-samples-chain/case-configuration.yml | 6 +
.../dubbo-call-scdubbo}/case-configuration.yml | 51 +++--
.../dubbo-samples-echo/case-configuration.yml | 3 +
.../dubbo-samples-merge/case-configuration.yml | 5 +
.../case-configuration.yml | 5 +-
.../case-configuration.yml | 5 +-
.../dubbo-samples-notify/case-configuration.yml | 4 +
.../case-configuration.yml | 6 +
.../dubbo-samples-seata/case-configuration.yml | 29 ++-
.../case-configuration.yml | 6 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 3 +
.../dubbo-call-sc/case-configuration.yml | 4 +
.../sc-call-dubbo/case-configuration.yml | 6 +
.../dubbo-samples-stub/case-configuration.yml | 4 +
.../dubbo-samples-tengine/case-configuration.yml | 4 +
.../dubbo-samples-version/case-configuration.yml | 6 +
.../case-configuration.yml | 40 +++-
.../case-configuration.yml | 8 +
.../dubbo-samples-http/case-configuration.yml | 6 +
.../case-configuration.yml | 3 +
.../dubbo-samples-triple/case-configuration.yml | 4 +
.../dubbo-samples-consul/case-configuration.yml | 4 +
.../case-configuration.yml | 5 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 6 +
.../dubbo-samples-zookeeper/case-configuration.yml | 4 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 6 +
.../dubbo-samples-monitor/case-configuration.yml | 6 +
.../dubbo-samples-sentinel/case-configuration.yml | 4 +
.../dubbo-samples-ssl/case-configuration.yml | 5 +-
.../dubbo-samples-tagrouter/case-configuration.yml | 6 +
.../dubbo-samples-zipkin/case-configuration.yml | 9 +-
.../case-configuration.yml | 21 +-
.../dubbo-samples-hibernate/case-configuration.yml | 4 +
.../case-configuration.yml | 2 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../dubbo-samples-mybatis/case-configuration.yml | 4 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 7 +-
.../case-configuration.yml | 4 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 2 +
.../case-configuration.yml | 2 +
.../case-configuration.yml | 2 +
.../case-configuration.yml | 22 +-
.../case-configuration.yml | 21 +-
.../case-configuration.yml | 25 ++-
.../case-configuration.yml | 4 +
.../dubbo-samples-sd-group/case-configuration.yml | 6 +
.../dubbo-samples-sd-merge/case-configuration.yml | 6 +
.../case-configuration.yml | 6 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 2 +
.../case-configuration.yml | 4 +
.../case-configuration.yml | 2 +
.../dubbo-samples-test-9806/case-configuration.yml | 2 +
.../case-configuration.yml | 27 ++-
test/build-nacos-image.sh | 5 -
test/build-test-image.sh | 5 +-
.../dubbo/scenario/builder/ConfigurationImpl.java | 248 ++++++++++++++-------
.../dubbo/scenario/builder/IConfiguration.java | 2 +-
.../scenario/builder/kubernetes/InitContainer.java | 74 ++++++
.../kubernetes/KubernetesRunningGenerator.java | 63 ++++++
.../builder/kubernetes/KubernetesService.java | 149 +++++++++++++
.../scenario/builder/vo/ServiceComponent.java | 57 ++++-
.../resources/configs/app-builtin-zookeeper.yml | 5 +-
.../resources/configs/app-external-zookeeper.yml | 4 +
.../main/resources/kubernetes-manifest.template | 187 ++++++++++++++++
.../src/main/resources/scenario.sh | 242 +++++++++++---------
test/dubbo-test-runner/src/docker/Dockerfile | 1 +
test/dubbo-test-runner/src/docker/run-dubbo-app.sh | 1 +
test/nacos-mysql/Dockerfile | 5 +
98 files changed, 1385 insertions(+), 251 deletions(-)
diff --git a/.github/workflows/dubbo-3_2.yml b/.github/workflows/dubbo-3_2.yml
index 2ed178e5..1f905ff2 100644
--- a/.github/workflows/dubbo-3_2.yml
+++ b/.github/workflows/dubbo-3_2.yml
@@ -163,6 +163,16 @@ jobs:
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
+ - name: Set up k3d
+ uses: nolar/setup-k3d-k3s@v1
+ with:
+ k3d-args: --no-lb --volume
/home/runner/work/dubbo-samples/dubbo-samples:/home/runner/work/dubbo-samples/dubbo-samples
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Image import
+ run: |
+ k3d image import library/nacos-mysql:5.7
+ k3d image import dubbo/sample-test:${JAVA_VER}
+ k3d image import busybox
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
diff --git a/.github/workflows/dubbo-3_3.yml b/.github/workflows/dubbo-3_3.yml
index ec292c53..44cf8d75 100644
--- a/.github/workflows/dubbo-3_3.yml
+++ b/.github/workflows/dubbo-3_3.yml
@@ -163,6 +163,16 @@ jobs:
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
+ - name: Set up k3d
+ uses: nolar/setup-k3d-k3s@v1
+ with:
+ k3d-args: --volume
/home/runner/work/dubbo-samples/dubbo-samples:/home/runner/work/dubbo-samples/dubbo-samples
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Image import
+ run: |
+ k3d image import library/nacos-mysql:5.7
+ k3d image import dubbo/sample-test:${JAVA_VER}
+ k3d image import busybox
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
diff --git a/.github/workflows/nightly-dubbo-3.yml
b/.github/workflows/nightly-dubbo-3.yml
index aee60782..08c68c32 100644
--- a/.github/workflows/nightly-dubbo-3.yml
+++ b/.github/workflows/nightly-dubbo-3.yml
@@ -166,6 +166,8 @@ jobs:
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
+ - name: Set up K3s cluster
+ uses: nolar/setup-k3d-k3s@v1
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
diff --git a/.gitignore b/.gitignore
index 3696cb69..bf831bab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,6 +64,5 @@ logs/
coverage.txt
test/jobs
-test/nacos-mysql
version-matrix.txt
target-jacoco/
\ No newline at end of file
diff --git a/1-basic/dubbo-samples-spring-boot/case-configuration.yml
b/1-basic/dubbo-samples-spring-boot/case-configuration.yml
index b1721bc0..45f7f8ad 100644
--- a/1-basic/dubbo-samples-spring-boot/case-configuration.yml
+++ b/1-basic/dubbo-samples-spring-boot/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -29,6 +31,8 @@ services:
checkPorts:
- 50052
checkLog: "Current Spring Boot Application is await..."
+ expose:
+ - 20880
test:
type: test
diff --git
a/2-advanced/dubbo-samples-async/dubbo-sample-async-generated-future-springboot/case-configuration.yml
b/2-advanced/dubbo-samples-async/dubbo-sample-async-generated-future-springboot/case-configuration.yml
index b623b3fb..59e467ad 100644
---
a/2-advanced/dubbo-samples-async/dubbo-sample-async-generated-future-springboot/case-configuration.yml
+++
b/2-advanced/dubbo-samples-async/dubbo-sample-async-generated-future-springboot/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -29,6 +31,8 @@ services:
checkPorts:
- 20880
checkLog: "Current Spring Boot Application is await..."
+ expose:
+ - 20880
test:
type: test
diff --git
a/2-advanced/dubbo-samples-async/dubbo-samples-async-generated-future-springboot/case-configuration.yml
b/2-advanced/dubbo-samples-async/dubbo-samples-async-generated-future-springboot/case-configuration.yml
index 87f793f5..babb7cf5 100644
---
a/2-advanced/dubbo-samples-async/dubbo-samples-async-generated-future-springboot/case-configuration.yml
+++
b/2-advanced/dubbo-samples-async/dubbo-samples-async-generated-future-springboot/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -29,6 +31,8 @@ services:
checkPorts:
- 20880
checkLog: "Current Spring Boot Application is await..."
+ expose:
+ - 20880
test:
type: test
diff --git
a/2-advanced/dubbo-samples-async/dubbo-samples-async-provider/case-configuration.yml
b/2-advanced/dubbo-samples-async/dubbo-samples-async-provider/case-configuration.yml
index 3c87b819..4d9878c3 100644
---
a/2-advanced/dubbo-samples-async/dubbo-samples-async-provider/case-configuration.yml
+++
b/2-advanced/dubbo-samples-async/dubbo-samples-async-provider/case-configuration.yml
@@ -42,6 +42,8 @@ props:
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
async-provider-embedded:
type: app
@@ -56,6 +58,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
async-provider:
type: app
@@ -72,6 +76,8 @@ services:
depends_on:
- zookeeper
- async-provider-embedded
+ expose:
+ - 20880
async-consumer-test:
type: test
diff --git
a/2-advanced/dubbo-samples-async/dubbo-samples-async-simple-boot/case-configuration.yml
b/2-advanced/dubbo-samples-async/dubbo-samples-async-simple-boot/case-configuration.yml
index e9da22c0..60b9c4e1 100644
---
a/2-advanced/dubbo-samples-async/dubbo-samples-async-simple-boot/case-configuration.yml
+++
b/2-advanced/dubbo-samples-async/dubbo-samples-async-simple-boot/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -29,6 +31,8 @@ services:
checkPorts:
- 20880
checkLog: "Current Spring Boot Application is await..."
+ expose:
+ - 20880
test:
type: test
basedir: dubbo-samples-async-simple-boot-consumer
diff --git a/2-advanced/dubbo-samples-attachment/case-configuration.yml
b/2-advanced/dubbo-samples-attachment/case-configuration.yml
index cb3c899e..13039bf3 100644
--- a/2-advanced/dubbo-samples-attachment/case-configuration.yml
+++ b/2-advanced/dubbo-samples-attachment/case-configuration.yml
@@ -19,6 +19,10 @@ services:
type: app
basedir: dubbo-samples-attachment-provider
mainClass: org.apache.dubbo.samples.attachment.AttachmentProvider
+ expose:
+ - 20880
+ - 2181
+
attachment-consumer:
type: test
basedir: dubbo-samples-attachment-consumer
diff --git a/2-advanced/dubbo-samples-autowire/case-configuration.yml
b/2-advanced/dubbo-samples-autowire/case-configuration.yml
index c71db322..ae21daee 100644
--- a/2-advanced/dubbo-samples-autowire/case-configuration.yml
+++ b/2-advanced/dubbo-samples-autowire/case-configuration.yml
@@ -17,11 +17,16 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
autowire-provider:
type: app
basedir: dubbo-samples-autowire-provider
mainClass: org.apache.dubbo.samples.autowire.provider.ProviderBootstrap
+ expose:
+ - 20880
+ - 2181
autowire-consumer:
type: test
diff --git a/2-advanced/dubbo-samples-cache/case-configuration.yml
b/2-advanced/dubbo-samples-cache/case-configuration.yml
index 5832e7a3..d7b2a6e6 100644
--- a/2-advanced/dubbo-samples-cache/case-configuration.yml
+++ b/2-advanced/dubbo-samples-cache/case-configuration.yml
@@ -18,6 +18,9 @@ services:
type: app
basedir: dubbo-samples-cache-provider
mainClass: org.apache.dubbo.samples.cache.CacheProvider
+ expose:
+ - 20880
+ - 2181
cache-consumer:
type: test
basedir: dubbo-samples-cache-consumer
diff --git a/2-advanced/dubbo-samples-callback/case-configuration.yml
b/2-advanced/dubbo-samples-callback/case-configuration.yml
index 25c9c424..1d207bf1 100644
--- a/2-advanced/dubbo-samples-callback/case-configuration.yml
+++ b/2-advanced/dubbo-samples-callback/case-configuration.yml
@@ -17,11 +17,16 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
callback-provider:
type: app
basedir: dubbo-samples-callback-provider
mainClass: org.apache.dubbo.samples.callback.provider.ProviderApplication
+ expose:
+ - 20880
+ - 2181
callback-consumer:
type: test
diff --git a/2-advanced/dubbo-samples-chain/case-configuration.yml
b/2-advanced/dubbo-samples-chain/case-configuration.yml
index 59d21f8c..65b823f9 100644
--- a/2-advanced/dubbo-samples-chain/case-configuration.yml
+++ b/2-advanced/dubbo-samples-chain/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-chain-backend:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-chain-middle:
type: app
@@ -47,6 +51,8 @@ services:
depends_on:
- zookeeper
- dubbo-samples-chain-backend
+ expose:
+ - 20881
dubbo-samples-chain-front:
type: test
diff --git
a/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
b/2-advanced/dubbo-samples-cloud-native/dubbo-call-scdubbo/case-configuration.yml
similarity index 62%
copy from
2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
copy to
2-advanced/dubbo-samples-cloud-native/dubbo-call-scdubbo/case-configuration.yml
index a5c3ab13..7bac878c 100644
---
a/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
+++
b/2-advanced/dubbo-samples-cloud-native/dubbo-call-scdubbo/case-configuration.yml
@@ -14,52 +14,65 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-timeout: 240
+ignoreFor: 'Interoperability between spring-cloud and dubbo is not ready?'
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
+
+ consul-server:
+ image: consul:latest
+ expose:
+ - 8500
- servicediscovery-migration-provider1:
+ dubbo-scdubbo-provider:
type: app
- basedir: dubbo-servicediscovery-migration-provider1
- mainClass: org.apache.dubbo.demo.provider.Application
+ basedir: dubbo-scdubbo-provider
+ mainClass: org.apache.dubbo.samples.microservices.sc.Application
systemProps:
- - zookeeper.address=zookeeper
+ - consul.address=consul-server
waitPortsBeforeRun:
- - zookeeper:2181
+ - consul-server:8500
checkPorts:
- - 20881
+ - 8099
checkLog: "dubbo service started"
depends_on:
- - zookeeper
-
- servicediscovery-migration-provider2:
+ - consul-server
+ expose:
+ - 8099
+
+ dubbo-scdubbo-provider2:
type: app
- basedir: dubbo-servicediscovery-migration-provider2
+ basedir: dubbo-scdubbo-provider2
mainClass: org.apache.dubbo.demo.provider.Application
systemProps:
- zookeeper.address=zookeeper
waitPortsBeforeRun:
- zookeeper:2181
checkPorts:
- - 20882
+ - 20880
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
- servicediscovery-migration-consumer-test:
+ dubbo-scdubbo-consumer-test:
type: test
- basedir: dubbo-servicediscovery-migration-consumer
+ basedir: dubbo-scdubbo-consumer
tests:
- "**/*IT.class"
systemProps:
+ - consul.address=consul-server
- zookeeper.address=zookeeper
waitPortsBeforeRun:
+ - consul-server:8500
- zookeeper:2181
- - servicediscovery-migration-provider1:20881
- - servicediscovery-migration-provider2:20882
+ - dubbo-scdubbo-provider:8099
+ - dubbo-scdubbo-provider2:20880
depends_on:
- - zookeeper
- - servicediscovery-migration-provider1
- - servicediscovery-migration-provider2
+ - consul-server
+ - dubbo-scdubbo-provider
+ - dubbo-scdubbo-provider2
diff --git a/2-advanced/dubbo-samples-echo/case-configuration.yml
b/2-advanced/dubbo-samples-echo/case-configuration.yml
index ada577ac..8f60e327 100644
--- a/2-advanced/dubbo-samples-echo/case-configuration.yml
+++ b/2-advanced/dubbo-samples-echo/case-configuration.yml
@@ -20,6 +20,9 @@ services:
type: app
basedir: dubbo-samples-echo-provider
mainClass: org.apache.dubbo.samples.provider.EchoProvider
+ expose:
+ - 20880
+ - 2181
cache-consumer:
type: test
diff --git a/2-advanced/dubbo-samples-merge/case-configuration.yml
b/2-advanced/dubbo-samples-merge/case-configuration.yml
index 8e46f1a1..1d5a5e2e 100644
--- a/2-advanced/dubbo-samples-merge/case-configuration.yml
+++ b/2-advanced/dubbo-samples-merge/case-configuration.yml
@@ -24,6 +24,9 @@ services:
checkPorts:
- 20880
checkLog: "dubbo service started"
+ expose:
+ - 20880
+ - 2181
dubbo-samples-merge-provider2:
type: app
@@ -42,6 +45,8 @@ services:
- dubbo-samples-merge-provider1:2181
- dubbo-samples-merge-provider1:20880
checkLog: "dubbo service started"
+ expose:
+ - 20881
dubbo-samples-merge-consumer1:
type: test
diff --git
a/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-application/case-configuration.yml
b/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-application/case-configuration.yml
index 10450471..b75912a2 100644
---
a/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-application/case-configuration.yml
+++
b/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-application/case-configuration.yml
@@ -28,12 +28,15 @@ services:
mainClass: ${app_provider_main_class}
systemProps:
- dubbo.current.protocol=tri
- - zookeeper.address=${app_provider}
+ - zookeeper.address=127.0.0.1
- dubbo.application.register-mode=instance
checkPorts:
- ${zookeeper_port}
- ${dubbo_port}
checkLog: "dubbo service started"
+ expose:
+ - ${zookeeper_port}
+ - ${dubbo_port}
${app_consumer}-test:
type: test
diff --git
a/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-default/case-configuration.yml
b/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-default/case-configuration.yml
index c87fe01f..3d1f4553 100644
---
a/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-default/case-configuration.yml
+++
b/2-advanced/dubbo-samples-migration/dubbo-samples-migration-case-default/case-configuration.yml
@@ -28,12 +28,15 @@ services:
mainClass: ${app_provider_main_class}
systemProps:
- dubbo.current.protocol=dubbo
- - zookeeper.address=${app_provider}
+ - zookeeper.address=localhost
- dubbo.application.register-mode=all
checkPorts:
- ${zookeeper_port}
- ${dubbo_port}
checkLog: "dubbo service started"
+ expose:
+ - ${zookeeper_port}
+ - ${dubbo_port}
${app_consumer}-test:
type: test
diff --git a/2-advanced/dubbo-samples-notify/case-configuration.yml
b/2-advanced/dubbo-samples-notify/case-configuration.yml
index 84aea320..ecf93ccb 100644
--- a/2-advanced/dubbo-samples-notify/case-configuration.yml
+++ b/2-advanced/dubbo-samples-notify/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-notify-provider:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "Current Spring Boot Application is await"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-notify-test:
type: test
diff --git a/2-advanced/dubbo-samples-rpccontext/case-configuration.yml
b/2-advanced/dubbo-samples-rpccontext/case-configuration.yml
index eb8d1385..9ba7a7c7 100644
--- a/2-advanced/dubbo-samples-rpccontext/case-configuration.yml
+++ b/2-advanced/dubbo-samples-rpccontext/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-rpccontext-provider2:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "Rpc context provider2 started"
depends_on:
- zookeeper
+ expose:
+ - 20882
dubbo-samples-rpccontext-provider:
@@ -47,6 +51,8 @@ services:
depends_on:
- zookeeper
- dubbo-samples-rpccontext-provider2
+ expose:
+ - 20880
dubbo-samples-rpccontext-consumer:
type: test
diff --git a/2-advanced/dubbo-samples-seata/case-configuration.yml
b/2-advanced/dubbo-samples-seata/case-configuration.yml
index ce464b91..e28a9556 100644
--- a/2-advanced/dubbo-samples-seata/case-configuration.yml
+++ b/2-advanced/dubbo-samples-seata/case-configuration.yml
@@ -31,6 +31,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
seata-mysql:
image: mysql:5.7
@@ -43,10 +45,16 @@ services:
- ${_basedir}/deploy/docker-compose/mysql/sql:/docker-entrypoint-initdb.d
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: ["CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1"]
- interval: 5s
- timeout: 5s
- retries: 20
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "-phelloworld"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 20
+ initialDelaySeconds: 10
seata-server:
#build: ${_basedir}/src/main/resources/docker/seata
@@ -59,6 +67,13 @@ services:
- 8091
depends_on:
- seata-mysql
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z seata-mysql 3306; do sleep 1; done;"
storage-service:
type: app
@@ -81,6 +96,8 @@ services:
- seata-mysql
- seata-server
- nacos
+ expose:
+ - 20884
account-service:
type: app
@@ -103,6 +120,8 @@ services:
- nacos
- seata-mysql
- seata-server
+ expose:
+ - 20881
order-service:
type: app
@@ -126,6 +145,8 @@ services:
- seata-mysql
- seata-server
- account-service
+ expose:
+ - 20883
business-test:
type: test
diff --git
a/2-advanced/dubbo-samples-service-discovery/dubbo-demo-servicediscovery-xml/case-configuration.yml
b/2-advanced/dubbo-samples-service-discovery/dubbo-demo-servicediscovery-xml/case-configuration.yml
index 31493984..f6b88349 100644
---
a/2-advanced/dubbo-samples-service-discovery/dubbo-demo-servicediscovery-xml/case-configuration.yml
+++
b/2-advanced/dubbo-samples-service-discovery/dubbo-demo-servicediscovery-xml/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
nacos:
image: nacos/nacos-server:1.4.0
@@ -27,6 +29,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
servicediscovery-provider:
type: app
@@ -43,6 +47,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
servicediscovery-consumer-test:
type: test
diff --git
a/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
b/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
index a5c3ab13..1d649b1e 100644
---
a/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
+++
b/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/case-configuration.yml
@@ -19,6 +19,8 @@ timeout: 240
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
servicediscovery-migration-provider1:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
servicediscovery-migration-provider2:
type: app
@@ -47,6 +51,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20882
servicediscovery-migration-consumer-test:
type: test
diff --git
a/2-advanced/dubbo-samples-service-discovery/servicediscovery-transfer/case-configuration.yml
b/2-advanced/dubbo-samples-service-discovery/servicediscovery-transfer/case-configuration.yml
index e58cbdd3..f846aad5 100644
---
a/2-advanced/dubbo-samples-service-discovery/servicediscovery-transfer/case-configuration.yml
+++
b/2-advanced/dubbo-samples-service-discovery/servicediscovery-transfer/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
servicediscovery-provider:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
servicediscovery-provider-instance:
type: app
@@ -46,6 +50,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
servicediscovery-consumer-test-old:
type: test
diff --git a/2-advanced/dubbo-samples-spi-compatible/case-configuration.yml
b/2-advanced/dubbo-samples-spi-compatible/case-configuration.yml
index 832600b8..81526d56 100644
--- a/2-advanced/dubbo-samples-spi-compatible/case-configuration.yml
+++ b/2-advanced/dubbo-samples-spi-compatible/case-configuration.yml
@@ -29,6 +29,9 @@ services:
checkPorts:
- 2181
checkLog: "dubbo service started"
+ expose:
+ - 2181
+ - 20880
dubbo-samples-spi-compatible-test:
type: test
diff --git
a/2-advanced/dubbo-samples-springcloud/dubbo-call-sc/case-configuration.yml
b/2-advanced/dubbo-samples-springcloud/dubbo-call-sc/case-configuration.yml
index e91088b6..3f7317dc 100644
--- a/2-advanced/dubbo-samples-springcloud/dubbo-call-sc/case-configuration.yml
+++ b/2-advanced/dubbo-samples-springcloud/dubbo-call-sc/case-configuration.yml
@@ -26,6 +26,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
sc-provider:
type: app
@@ -38,6 +40,8 @@ services:
checkLog: "sc-provider started"
depends_on:
- nacos-server
+ expose:
+ - 8099
dubbo-sc-consumer-test:
type: test
diff --git
a/2-advanced/dubbo-samples-springcloud/sc-call-dubbo/case-configuration.yml
b/2-advanced/dubbo-samples-springcloud/sc-call-dubbo/case-configuration.yml
index 1c7bd5c8..bfb520d1 100644
--- a/2-advanced/dubbo-samples-springcloud/sc-call-dubbo/case-configuration.yml
+++ b/2-advanced/dubbo-samples-springcloud/sc-call-dubbo/case-configuration.yml
@@ -26,6 +26,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-provider:
type: app
@@ -38,6 +40,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos-server
+ expose:
+ - 8090
sc-consumer:
type: app
@@ -50,6 +54,8 @@ services:
checkLog: "sc-consumer started"
depends_on:
- nacos-server
+ expose:
+ - 8099
sc-dubbo-consumer-test:
type: test
diff --git a/2-advanced/dubbo-samples-stub/case-configuration.yml
b/2-advanced/dubbo-samples-stub/case-configuration.yml
index 25994b7c..fc4fc22f 100644
--- a/2-advanced/dubbo-samples-stub/case-configuration.yml
+++ b/2-advanced/dubbo-samples-stub/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -29,6 +31,8 @@ services:
checkPorts:
- 20880
checkLog: "Current Spring Boot Application is await..."
+ expose:
+ - 20880
test:
type: test
diff --git a/2-advanced/dubbo-samples-tengine/case-configuration.yml
b/2-advanced/dubbo-samples-tengine/case-configuration.yml
index 13fb926f..d7f25769 100644
--- a/2-advanced/dubbo-samples-tengine/case-configuration.yml
+++ b/2-advanced/dubbo-samples-tengine/case-configuration.yml
@@ -23,6 +23,8 @@ services:
- dubbo-samples-tengine-provider:20880
depends_on:
- dubbo-samples-tengine-provider
+ expose:
+ - 8080
dubbo-samples-tengine-provider:
type: app
@@ -31,6 +33,8 @@ services:
checkPorts:
- 20880
checkLog: "dubbo service started"
+ expose:
+ - 20880
dubbo-samples-tengine-test:
type: test
diff --git a/2-advanced/dubbo-samples-version/case-configuration.yml
b/2-advanced/dubbo-samples-version/case-configuration.yml
index 4c817b37..cc1e9466 100644
--- a/2-advanced/dubbo-samples-version/case-configuration.yml
+++ b/2-advanced/dubbo-samples-version/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-version-provider:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-version-provider2:
type: app
@@ -45,6 +49,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20882
dubbo-samples-version-consumer:
type: test
diff --git
a/3-extensions/configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
b/3-extensions/configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
index 4a47be43..b213955a 100644
---
a/3-extensions/configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
+++
b/3-extensions/configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
@@ -36,6 +36,16 @@ services:
depends_on:
- apollo-db
- apollo-quick-start
+ expose:
+ - 20880
+ - 2181
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z apollo-db 3306; do sleep 1; done;"
dubbo-samples-configcenter-apollo-test:
type: test
@@ -73,11 +83,18 @@ services:
-
${_basedir}/src/main/resources/docker/demo.sh:/apollo-quick-start/demo.sh
- ./logs:/apollo-quick-start/logs
healthcheck:
- #check apollo config service api
- test: 'curl -Ss http://localhost:8080/services/config\?appId=SampleApp |
grep apollo-configservice'
- interval: 5s
- timeout: 5s
- retries: 60
+ test:
+ - "curl"
+ - "-Ss"
+ - "http://localhost:8080/services/config\?appId=SampleApp"
+ - "|"
+ - "grep"
+ - "apollo-configservice"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 60
+ initialDelaySeconds: 10
apollo-db:
image: mysql:5.7
@@ -88,10 +105,15 @@ services:
- 3306
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: ["CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1"]
- interval: 5s
- timeout: 5s
- retries: 40
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 40
+ initialDelaySeconds: 10
volumes:
- ${_basedir}/src/main/resources/docker/sql:/docker-entrypoint-initdb.d
#- ./sql_data:/var/lib/mysql
diff --git
a/3-extensions/configcenter/dubbo-samples-configcenter-multi-registries/case-configuration.yml
b/3-extensions/configcenter/dubbo-samples-configcenter-multi-registries/case-configuration.yml
index fafcbf63..232fa92f 100644
---
a/3-extensions/configcenter/dubbo-samples-configcenter-multi-registries/case-configuration.yml
+++
b/3-extensions/configcenter/dubbo-samples-configcenter-multi-registries/case-configuration.yml
@@ -17,12 +17,18 @@
services:
config-center:
image: zookeeper:latest
+ expose:
+ - 2181
zookeeper1:
image: zookeeper:latest
+ expose:
+ - 2181
zookeeper2:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-configcenter-multi-registries:
type: app
@@ -46,6 +52,8 @@ services:
- config-center
- zookeeper1
- zookeeper2
+ expose:
+ - 20880
dubbo-samples-configcenter-multi-registries-test:
type: test
diff --git a/3-extensions/protocol/dubbo-samples-http/case-configuration.yml
b/3-extensions/protocol/dubbo-samples-http/case-configuration.yml
index 6b7188c0..27943577 100644
--- a/3-extensions/protocol/dubbo-samples-http/case-configuration.yml
+++ b/3-extensions/protocol/dubbo-samples-http/case-configuration.yml
@@ -16,6 +16,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-http-tomcat:
type: app
@@ -31,6 +33,8 @@ services:
checkPorts:
- 8080
checkLog: "dubbo service started"
+ expose:
+ - 8080
dubbo-samples-http-jetty:
type: app
@@ -46,6 +50,8 @@ services:
checkPorts:
- 8081
checkLog: "dubbo service started"
+ expose:
+ - 8081
dubbo-samples-http-test:
type: test
diff --git
a/3-extensions/protocol/dubbo-samples-triple-reactor/case-configuration.yml
b/3-extensions/protocol/dubbo-samples-triple-reactor/case-configuration.yml
index 8e4c9218..73aba5ff 100644
--- a/3-extensions/protocol/dubbo-samples-triple-reactor/case-configuration.yml
+++ b/3-extensions/protocol/dubbo-samples-triple-reactor/case-configuration.yml
@@ -22,6 +22,9 @@ services:
- 2181
- 50052
mainClass: org.apache.dubbo.samples.triple.reactor.ReactorServer
+ expose:
+ - 2181
+ - 50052
dubbo-samples-triple-reactor-test:
type: test
diff --git a/3-extensions/protocol/dubbo-samples-triple/case-configuration.yml
b/3-extensions/protocol/dubbo-samples-triple/case-configuration.yml
index 676718f2..b6075ed3 100644
--- a/3-extensions/protocol/dubbo-samples-triple/case-configuration.yml
+++ b/3-extensions/protocol/dubbo-samples-triple/case-configuration.yml
@@ -23,6 +23,10 @@ services:
- 50052
- 50053
mainClass: org.apache.dubbo.sample.tri.TestServers
+ expose:
+ - 2181
+ - 50052
+ - 50053
dubbo-samples-triple-test:
type: test
diff --git a/3-extensions/registry/dubbo-samples-consul/case-configuration.yml
b/3-extensions/registry/dubbo-samples-consul/case-configuration.yml
index f0226a2f..c8f24ea4 100644
--- a/3-extensions/registry/dubbo-samples-consul/case-configuration.yml
+++ b/3-extensions/registry/dubbo-samples-consul/case-configuration.yml
@@ -17,6 +17,8 @@
services:
consul:
image: consul:1.9.1
+ expose:
+ - 8500
dubbo-samples-consul:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- consul
+ expose:
+ - 20880
dubbo-samples-consul-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-default-config/case-configuration.yml
b/3-extensions/registry/dubbo-samples-default-config/case-configuration.yml
index fbc91170..e1c62671 100644
--- a/3-extensions/registry/dubbo-samples-default-config/case-configuration.yml
+++ b/3-extensions/registry/dubbo-samples-default-config/case-configuration.yml
@@ -31,6 +31,11 @@ services:
- ${dubbo_port}
- ${hessian_port}
checkLog: "dubbo service started"
+ expose:
+ - ${zookeeper_port1}
+ - ${zookeeper_port2}
+ - ${dubbo_port}
+ - ${hessian_port}
dubbo-samples-default-config-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-multi-registry/case-configuration.yml
b/3-extensions/registry/dubbo-samples-multi-registry/case-configuration.yml
index 0a618ad9..156d83de 100644
--- a/3-extensions/registry/dubbo-samples-multi-registry/case-configuration.yml
+++ b/3-extensions/registry/dubbo-samples-multi-registry/case-configuration.yml
@@ -17,9 +17,13 @@
services:
zookeeper-1:
image: zookeeper:latest
+ expose:
+ - 2181
zookeeper-2:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-multi-registry:
type: app
@@ -38,6 +42,8 @@ services:
depends_on:
- zookeeper-1
- zookeeper-2
+ expose:
+ - 20880
dubbo-samples-multi-registry-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-conditionrouter/case-configuration.yml
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-conditionrouter/case-configuration.yml
index b13dcec1..600d7a31 100644
---
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-conditionrouter/case-configuration.yml
+++
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-conditionrouter/case-configuration.yml
@@ -31,6 +31,8 @@ services:
interval: 5s
timeout: 5s
retries: 40
+ expose:
+ - 8848
dubbo-samples-nacos-conditionrouter1:
type: app
@@ -47,6 +49,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-conditionrouter2:
type: app
@@ -63,6 +67,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20881
dubbo-samples-nacos-conditionrouter-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-configcenter/case-configuration.yml
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-configcenter/case-configuration.yml
index 67bc3ba6..45cb1aff 100644
---
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-configcenter/case-configuration.yml
+++
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-configcenter/case-configuration.yml
@@ -26,6 +26,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-configcenter:
type: app
@@ -41,6 +43,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-configcenter-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-group/case-configuration.yml
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-group/case-configuration.yml
index bc113563..f480985f 100644
---
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-group/case-configuration.yml
+++
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-group/case-configuration.yml
@@ -24,6 +24,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-group:
type: app
@@ -39,6 +41,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-group-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-override/case-configuration.yml
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-override/case-configuration.yml
index 4c4201c9..2a7320b9 100644
---
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-override/case-configuration.yml
+++
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-override/case-configuration.yml
@@ -26,6 +26,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-override:
type: app
@@ -41,6 +43,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-override-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/case-configuration.yml
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/case-configuration.yml
index 613bdfdf..207d43ab 100644
---
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/case-configuration.yml
+++
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/case-configuration.yml
@@ -26,6 +26,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-registry:
type: app
@@ -41,6 +43,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-registry-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-tagrouter/case-configuration.yml
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-tagrouter/case-configuration.yml
index 7486b098..8520f626 100644
---
a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-tagrouter/case-configuration.yml
+++
b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-tagrouter/case-configuration.yml
@@ -26,6 +26,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-tagrouter1:
type: app
@@ -42,6 +44,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-tagrouter2:
type: app
@@ -58,6 +62,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20881
dubbo-samples-nacos-tagrouter-test:
type: test
diff --git
a/3-extensions/registry/dubbo-samples-zookeeper/case-configuration.yml
b/3-extensions/registry/dubbo-samples-zookeeper/case-configuration.yml
index a6ac8022..dbf0aa8e 100644
--- a/3-extensions/registry/dubbo-samples-zookeeper/case-configuration.yml
+++ b/3-extensions/registry/dubbo-samples-zookeeper/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:${zookeeper-server.version}
+ expose:
+ - 2181
dubbo-samples-zookeeper:
type: app
@@ -30,6 +32,8 @@ services:
checkPorts:
- 20880
checkLog: "dubbo service started"
+ expose:
+ - 20880
dubbo-samples-zookeeper-test:
type: test
diff --git
a/4-governance/dubbo-samples-applevel-override/case-configuration.yml
b/4-governance/dubbo-samples-applevel-override/case-configuration.yml
index 7a24d00a..cd730e6f 100644
--- a/4-governance/dubbo-samples-applevel-override/case-configuration.yml
+++ b/4-governance/dubbo-samples-applevel-override/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-applevel-override1:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-applevel-override2:
type: app
@@ -49,6 +53,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
dubbo-samples-applevel-override-test:
type: test
diff --git
a/4-governance/dubbo-samples-configconditionrouter/case-configuration.yml
b/4-governance/dubbo-samples-configconditionrouter/case-configuration.yml
index f0c14c89..14e4f7cb 100644
--- a/4-governance/dubbo-samples-configconditionrouter/case-configuration.yml
+++ b/4-governance/dubbo-samples-configconditionrouter/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-configconditionrouter1:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-configconditionrouter2:
type: app
@@ -49,6 +53,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
dubbo-samples-configconditionrouter-test:
type: test
diff --git a/4-governance/dubbo-samples-meshrule-router/case-configuration.yml
b/4-governance/dubbo-samples-meshrule-router/case-configuration.yml
index 1f6c3375..6f584912 100644
--- a/4-governance/dubbo-samples-meshrule-router/case-configuration.yml
+++ b/4-governance/dubbo-samples-meshrule-router/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-mesh-router-1:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-mesh-router-2:
type: app
@@ -49,6 +53,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 2181
dubbo-samples-mesh-router-test:
type: test
diff --git
a/4-governance/dubbo-samples-metrics-prometheus/case-configuration.yml
b/4-governance/dubbo-samples-metrics-prometheus/case-configuration.yml
index d02d8fa7..c0b75fad 100644
--- a/4-governance/dubbo-samples-metrics-prometheus/case-configuration.yml
+++ b/4-governance/dubbo-samples-metrics-prometheus/case-configuration.yml
@@ -17,11 +17,15 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
metrics-prometheus-provider:
type: app
basedir: dubbo-samples-metrics-prometheus-provider
mainClass:
org.apache.dubbo.samples.metrics.prometheus.provider.MetricsProvider
+ expose:
+ - 20880
metrics-prometheus-consumer:
type: test
diff --git
a/4-governance/dubbo-samples-metrics-spring-boot/case-configuration.yml
b/4-governance/dubbo-samples-metrics-spring-boot/case-configuration.yml
index c42bab59..94d38f22 100644
--- a/4-governance/dubbo-samples-metrics-spring-boot/case-configuration.yml
+++ b/4-governance/dubbo-samples-metrics-spring-boot/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -29,6 +31,10 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 18081
+ - 18080
+
test:
diff --git a/4-governance/dubbo-samples-monitor/case-configuration.yml
b/4-governance/dubbo-samples-monitor/case-configuration.yml
index 77b07731..4ce810c0 100644
--- a/4-governance/dubbo-samples-monitor/case-configuration.yml
+++ b/4-governance/dubbo-samples-monitor/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-provider:
type: app
@@ -30,6 +32,8 @@ services:
checkPorts:
- 20880
checkLog: "dubbo service started"
+ expose:
+ - 20880
dubbo-monitor:
type: app
@@ -43,6 +47,8 @@ services:
checkPorts:
- 20881
checkLog: "dubbo service started"
+ expose:
+ - 20881
monitor-test:
type: test
diff --git a/4-governance/dubbo-samples-sentinel/case-configuration.yml
b/4-governance/dubbo-samples-sentinel/case-configuration.yml
index efd50a84..0762a7c0 100644
--- a/4-governance/dubbo-samples-sentinel/case-configuration.yml
+++ b/4-governance/dubbo-samples-sentinel/case-configuration.yml
@@ -25,6 +25,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-sentinel-provider:
type: app
@@ -39,6 +41,8 @@ services:
- 20880
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-sentinel-consumer:
type: test
diff --git a/4-governance/dubbo-samples-ssl/case-configuration.yml
b/4-governance/dubbo-samples-ssl/case-configuration.yml
index 26a21257..c1540728 100644
--- a/4-governance/dubbo-samples-ssl/case-configuration.yml
+++ b/4-governance/dubbo-samples-ssl/case-configuration.yml
@@ -23,7 +23,7 @@ services:
volumes:
-
${_basedir}/dubbo-samples-ssl-provider/src/main/resources/certs:/dubbo-samples-ssl-provider/certs
systemProps:
- - zookeeper.address=dubbo-samples-ssl-provider
+ - zookeeper.address=127.0.0.1
- zookeeper.port=2181
-
dubbo.ssl.server-key-cert-chain-path=/dubbo-samples-ssl-provider/certs/server0.pem
-
dubbo.ssl.server-private-key-path=/dubbo-samples-ssl-provider/certs/server0.key
@@ -31,6 +31,9 @@ services:
checkPorts:
- 20880
checkLog: "dubbo service started"
+ expose:
+ - 20880
+ - 2181
dubbo-samples-ssl-test:
type: test
diff --git a/4-governance/dubbo-samples-tagrouter/case-configuration.yml
b/4-governance/dubbo-samples-tagrouter/case-configuration.yml
index 00f10ec7..d4a4f326 100644
--- a/4-governance/dubbo-samples-tagrouter/case-configuration.yml
+++ b/4-governance/dubbo-samples-tagrouter/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-tagrouter1:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-tagrouter2:
type: app
@@ -49,6 +53,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
dubbo-samples-tagrouter-test:
type: test
diff --git a/4-governance/dubbo-samples-zipkin/case-configuration.yml
b/4-governance/dubbo-samples-zipkin/case-configuration.yml
index 65681235..bae8ca8c 100644
--- a/4-governance/dubbo-samples-zipkin/case-configuration.yml
+++ b/4-governance/dubbo-samples-zipkin/case-configuration.yml
@@ -18,9 +18,13 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
zipkin:
image: openzipkin/zipkin
+ expose:
+ - 9411
dubbo-samples-zipkin-hello:
type: app
@@ -38,6 +42,8 @@ services:
depends_on:
- zookeeper
- zipkin
+ expose:
+ - 20880
dubbo-samples-zipkin-greeting:
type: app
@@ -57,7 +63,8 @@ services:
- zookeeper
- zipkin
- dubbo-samples-zipkin-hello
-
+ expose:
+ - 20881
dubbo-samples-zipkin-test:
type: test
basedir: .
diff --git
a/99-integration/dubbo-samples-empty-protection-nacos/case-configuration.yml
b/99-integration/dubbo-samples-empty-protection-nacos/case-configuration.yml
index 7c614d1e..66264e52 100644
--- a/99-integration/dubbo-samples-empty-protection-nacos/case-configuration.yml
+++ b/99-integration/dubbo-samples-empty-protection-nacos/case-configuration.yml
@@ -26,10 +26,16 @@ services:
- 3306
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: [ "CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1" ]
- interval: 5s
- timeout: 5s
- retries: 20
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "-proot"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 20
+ initialDelaySeconds: 10
nacos:
image: nacos/nacos-server:v2.1.2
@@ -53,6 +59,13 @@ services:
- 9555
depends_on:
- nacos-mysql
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z nacos-mysql 3306; do sleep 1; done;"
dubbo-samples-empty-protection-nacos:
type: test
diff --git a/99-integration/dubbo-samples-hibernate/case-configuration.yml
b/99-integration/dubbo-samples-hibernate/case-configuration.yml
index 693210d8..afa2d4b7 100644
--- a/99-integration/dubbo-samples-hibernate/case-configuration.yml
+++ b/99-integration/dubbo-samples-hibernate/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-spring-boot-hibernate-provider:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-spring-boot-hibernate-consumer:
type: test
diff --git
a/99-integration/dubbo-samples-isolation-executor/case-configuration.yml
b/99-integration/dubbo-samples-isolation-executor/case-configuration.yml
index 942e6a0d..15a7bb61 100644
--- a/99-integration/dubbo-samples-isolation-executor/case-configuration.yml
+++ b/99-integration/dubbo-samples-isolation-executor/case-configuration.yml
@@ -16,6 +16,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-isolation-executor-test:
type: test
diff --git a/99-integration/dubbo-samples-memory-server/case-configuration.yml
b/99-integration/dubbo-samples-memory-server/case-configuration.yml
index f8d3a780..cac80896 100644
--- a/99-integration/dubbo-samples-memory-server/case-configuration.yml
+++ b/99-integration/dubbo-samples-memory-server/case-configuration.yml
@@ -19,6 +19,8 @@ timeout: 1000
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
test:
type: test
diff --git
a/99-integration/dubbo-samples-memory-tri-server/case-configuration.yml
b/99-integration/dubbo-samples-memory-tri-server/case-configuration.yml
index 72af9c33..b199e881 100644
--- a/99-integration/dubbo-samples-memory-tri-server/case-configuration.yml
+++ b/99-integration/dubbo-samples-memory-tri-server/case-configuration.yml
@@ -19,6 +19,8 @@ timeout: 1000
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 50051
test:
type: test
diff --git a/99-integration/dubbo-samples-multi-port/case-configuration.yml
b/99-integration/dubbo-samples-multi-port/case-configuration.yml
index 28b4ca09..7acc6320 100644
--- a/99-integration/dubbo-samples-multi-port/case-configuration.yml
+++ b/99-integration/dubbo-samples-multi-port/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
test:
type: test
diff --git a/99-integration/dubbo-samples-mybatis/case-configuration.yml
b/99-integration/dubbo-samples-mybatis/case-configuration.yml
index 91704126..fdf5d1f4 100644
--- a/99-integration/dubbo-samples-mybatis/case-configuration.yml
+++ b/99-integration/dubbo-samples-mybatis/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-spring-boot-mybatis-provider:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-spring-boot-mybatis-consumer:
type: test
diff --git a/99-integration/dubbo-samples-nacos-legacy/case-configuration.yml
b/99-integration/dubbo-samples-nacos-legacy/case-configuration.yml
index cc35520f..e381a961 100644
--- a/99-integration/dubbo-samples-nacos-legacy/case-configuration.yml
+++ b/99-integration/dubbo-samples-nacos-legacy/case-configuration.yml
@@ -24,6 +24,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-legacy-provider1:
type: app
@@ -39,6 +41,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20880
dubbo-samples-nacos-legacy-provider2:
type: app
@@ -54,6 +58,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20881
dubbo-samples-nacos-legacy-consumer:
type: test
diff --git a/99-integration/dubbo-samples-nacos-merge/case-configuration.yml
b/99-integration/dubbo-samples-nacos-merge/case-configuration.yml
index c698cf80..fb11616b 100644
--- a/99-integration/dubbo-samples-nacos-merge/case-configuration.yml
+++ b/99-integration/dubbo-samples-nacos-merge/case-configuration.yml
@@ -25,6 +25,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-nacos-merge-provider1:
type: app
@@ -40,7 +42,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
-
+ expose:
+ - 20880
dubbo-samples-nacos-merge-provider2:
type: app
basedir: dubbo-samples-nacos-merge-provider2
@@ -55,6 +58,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- nacos
+ expose:
+ - 20881
dubbo-samples-nacos-merge-consumer:
type: test
diff --git
a/99-integration/dubbo-samples-prefer-serialization-test-31x/case-configuration.yml
b/99-integration/dubbo-samples-prefer-serialization-test-31x/case-configuration.yml
index 25eea072..7d3c8236 100644
---
a/99-integration/dubbo-samples-prefer-serialization-test-31x/case-configuration.yml
+++
b/99-integration/dubbo-samples-prefer-serialization-test-31x/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-prefer-serialization-test-31x-provider:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-prefer-serialization-test-31x-consumer:
type: test
diff --git
a/99-integration/dubbo-samples-prefer-serialization-test/case-configuration.yml
b/99-integration/dubbo-samples-prefer-serialization-test/case-configuration.yml
index 2242effd..41f8e698 100644
---
a/99-integration/dubbo-samples-prefer-serialization-test/case-configuration.yml
+++
b/99-integration/dubbo-samples-prefer-serialization-test/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-prefer-serialization-test-provider:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-prefer-serialization-test-consumer:
type: test
diff --git
a/99-integration/dubbo-samples-registry-test-curator-instance/case-configuration.yml
b/99-integration/dubbo-samples-registry-test-curator-instance/case-configuration.yml
index 82689a62..0110724c 100644
---
a/99-integration/dubbo-samples-registry-test-curator-instance/case-configuration.yml
+++
b/99-integration/dubbo-samples-registry-test-curator-instance/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
app1:
type: app
diff --git
a/99-integration/dubbo-samples-registry-test-curator-interface/case-configuration.yml
b/99-integration/dubbo-samples-registry-test-curator-interface/case-configuration.yml
index 82689a62..0110724c 100644
---
a/99-integration/dubbo-samples-registry-test-curator-interface/case-configuration.yml
+++
b/99-integration/dubbo-samples-registry-test-curator-interface/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
app1:
type: app
diff --git
a/99-integration/dubbo-samples-registry-test-curator/case-configuration.yml
b/99-integration/dubbo-samples-registry-test-curator/case-configuration.yml
index 82689a62..0110724c 100644
--- a/99-integration/dubbo-samples-registry-test-curator/case-configuration.yml
+++ b/99-integration/dubbo-samples-registry-test-curator/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
app1:
type: app
diff --git
a/99-integration/dubbo-samples-registry-test-nacos-instance/case-configuration.yml
b/99-integration/dubbo-samples-registry-test-nacos-instance/case-configuration.yml
index 470c67c0..f36cbd22 100644
---
a/99-integration/dubbo-samples-registry-test-nacos-instance/case-configuration.yml
+++
b/99-integration/dubbo-samples-registry-test-nacos-instance/case-configuration.yml
@@ -24,14 +24,21 @@ services:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=nacos
- MYSQL_PASSWORD=nacos
+ - MYSQL_ALLOW_EMPTY_PASSWORD=yes
expose:
- 3306
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: [ "CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1" ]
- interval: 5s
- timeout: 5s
- retries: 20
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "-proot"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 20
+ initialDelaySeconds: 10
nacos:
image: nacos/nacos-server:v2.1.2
@@ -57,6 +64,13 @@ services:
-
${_basedir}/src/test/resources/nacos-logback-stdout.xml:/home/nacos/conf/nacos-logback.xml
depends_on:
- nacos-mysql
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z nacos-mysql 3306; do sleep 1; done;"
app:
type: app
diff --git
a/99-integration/dubbo-samples-registry-test-nacos-interface/case-configuration.yml
b/99-integration/dubbo-samples-registry-test-nacos-interface/case-configuration.yml
index 470c67c0..e874f63d 100644
---
a/99-integration/dubbo-samples-registry-test-nacos-interface/case-configuration.yml
+++
b/99-integration/dubbo-samples-registry-test-nacos-interface/case-configuration.yml
@@ -28,10 +28,16 @@ services:
- 3306
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: [ "CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1" ]
- interval: 5s
- timeout: 5s
- retries: 20
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "-proot"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 20
+ initialDelaySeconds: 10
nacos:
image: nacos/nacos-server:v2.1.2
@@ -57,6 +63,13 @@ services:
-
${_basedir}/src/test/resources/nacos-logback-stdout.xml:/home/nacos/conf/nacos-logback.xml
depends_on:
- nacos-mysql
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z nacos-mysql 3306; do sleep 1; done;"
app:
type: app
diff --git
a/99-integration/dubbo-samples-registry-test-nacos/case-configuration.yml
b/99-integration/dubbo-samples-registry-test-nacos/case-configuration.yml
index 9936853e..1611471f 100644
--- a/99-integration/dubbo-samples-registry-test-nacos/case-configuration.yml
+++ b/99-integration/dubbo-samples-registry-test-nacos/case-configuration.yml
@@ -28,10 +28,17 @@ services:
- 3306
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: [ "CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1" ]
- interval: 5s
- timeout: 5s
- retries: 20
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "-proot"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 20
+ initialDelaySeconds: 10
+
nacos:
image: nacos/nacos-server:v2.1.2
@@ -57,7 +64,13 @@ services:
-
${_basedir}/src/test/resources/nacos-logback-stdout.xml:/home/nacos/conf/nacos-logback.xml
depends_on:
- nacos-mysql
-
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z nacos-mysql 3306; do sleep 1; done;"
app:
type: app
basedir: .
@@ -69,6 +82,8 @@ services:
depends_on:
- nacos
checkLog: "All apps started"
+ expose:
+ - 20881
test:
type: test
diff --git a/99-integration/dubbo-samples-rest-withtoken/case-configuration.yml
b/99-integration/dubbo-samples-rest-withtoken/case-configuration.yml
index 2aa04ecf..8bb311d0 100644
--- a/99-integration/dubbo-samples-rest-withtoken/case-configuration.yml
+++ b/99-integration/dubbo-samples-rest-withtoken/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-rest-withtoken-provider:
type: app
@@ -29,6 +31,8 @@ services:
- zookeeper:2181
depends_on:
- zookeeper
+ expose:
+ - 8080
dubbo-samples-rest-withtoken-consumer:
type: test
diff --git a/99-integration/dubbo-samples-sd-group/case-configuration.yml
b/99-integration/dubbo-samples-sd-group/case-configuration.yml
index 7355ec77..6313ff2d 100644
--- a/99-integration/dubbo-samples-sd-group/case-configuration.yml
+++ b/99-integration/dubbo-samples-sd-group/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-sd-group-provider1:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-sd-group-provider2:
type: app
@@ -46,6 +50,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
dubbo-samples-sd-group-consumer:
type: test
diff --git a/99-integration/dubbo-samples-sd-merge/case-configuration.yml
b/99-integration/dubbo-samples-sd-merge/case-configuration.yml
index c242f7cf..d1614153 100644
--- a/99-integration/dubbo-samples-sd-merge/case-configuration.yml
+++ b/99-integration/dubbo-samples-sd-merge/case-configuration.yml
@@ -18,6 +18,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-sd-merge-provider1:
type: app
@@ -32,6 +34,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-sd-merge-provider2:
type: app
@@ -46,6 +50,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20881
dubbo-samples-sd-merge-consumer:
type: test
diff --git a/99-integration/dubbo-samples-sd-version/case-configuration.yml
b/99-integration/dubbo-samples-sd-version/case-configuration.yml
index e2fdb15c..e9fc044d 100644
--- a/99-integration/dubbo-samples-sd-version/case-configuration.yml
+++ b/99-integration/dubbo-samples-sd-version/case-configuration.yml
@@ -17,6 +17,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-sd-version-provider:
type: app
@@ -31,6 +33,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20880
dubbo-samples-sd-version-provider2:
type: app
@@ -45,6 +49,8 @@ services:
checkLog: "dubbo service started"
depends_on:
- zookeeper
+ expose:
+ - 20882
dubbo-samples-sd-version-consumer:
type: test
diff --git
a/99-integration/dubbo-samples-serialize-check/case-configuration.yml
b/99-integration/dubbo-samples-serialize-check/case-configuration.yml
index d1e8e1d0..29a0bcea 100644
--- a/99-integration/dubbo-samples-serialize-check/case-configuration.yml
+++ b/99-integration/dubbo-samples-serialize-check/case-configuration.yml
@@ -19,6 +19,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
provider:
type: app
@@ -33,6 +35,8 @@ services:
checkLog: "DubboBootstrap awaiting"
depends_on:
- zookeeper
+ expose:
+ - 20880
test:
type: test
diff --git a/99-integration/dubbo-samples-test-11096/case-configuration.yml
b/99-integration/dubbo-samples-test-11096/case-configuration.yml
index 28d68fcf..f3c1ab81 100644
--- a/99-integration/dubbo-samples-test-11096/case-configuration.yml
+++ b/99-integration/dubbo-samples-test-11096/case-configuration.yml
@@ -19,6 +19,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-test-11096-test:
type: test
diff --git a/99-integration/dubbo-samples-test-11137/case-configuration.yml
b/99-integration/dubbo-samples-test-11137/case-configuration.yml
index df3c5949..3c12e793 100644
--- a/99-integration/dubbo-samples-test-11137/case-configuration.yml
+++ b/99-integration/dubbo-samples-test-11137/case-configuration.yml
@@ -19,6 +19,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
nacos:
image: nacos/nacos-server:2.0.0
@@ -29,6 +31,8 @@ services:
- JVM_XMS=512m
- JVM_XMX=512m
- JVM_XMN=256m
+ expose:
+ - 8848
dubbo-samples-test-11096-test:
type: test
diff --git a/99-integration/dubbo-samples-test-11159/case-configuration.yml
b/99-integration/dubbo-samples-test-11159/case-configuration.yml
index afc8625f..1c1ac60d 100644
--- a/99-integration/dubbo-samples-test-11159/case-configuration.yml
+++ b/99-integration/dubbo-samples-test-11159/case-configuration.yml
@@ -19,6 +19,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-test-11096-test:
type: test
diff --git a/99-integration/dubbo-samples-test-9806/case-configuration.yml
b/99-integration/dubbo-samples-test-9806/case-configuration.yml
index 77a72d4b..ef2f0fec 100644
--- a/99-integration/dubbo-samples-test-9806/case-configuration.yml
+++ b/99-integration/dubbo-samples-test-9806/case-configuration.yml
@@ -19,6 +19,8 @@
services:
zookeeper:
image: zookeeper:latest
+ expose:
+ - 2181
dubbo-samples-test-9806-test:
type: test
diff --git a/99-integration/dubbo-samples-transaction/case-configuration.yml
b/99-integration/dubbo-samples-transaction/case-configuration.yml
index f32dafd0..c0edf754 100644
--- a/99-integration/dubbo-samples-transaction/case-configuration.yml
+++ b/99-integration/dubbo-samples-transaction/case-configuration.yml
@@ -38,10 +38,16 @@ services:
-
${_basedir}/src/main/resources/docker/mysql/sql:/docker-entrypoint-initdb.d
healthcheck:
# mysql host MUST be ip address, if the host is localhost, may connect
via socket file, the port will be ignored
- test: ["CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1"]
- interval: 5s
- timeout: 5s
- retries: 20
+ test:
+ - "mysqladmin"
+ - "-uroot"
+ - "-phelloworld"
+ - "ping"
+ timeoutSeconds: 5
+ periodSeconds: 5
+ successThreshold: 1
+ failureThreshold: 20
+ initialDelaySeconds: 10
seata-server:
#build: ${_basedir}/src/main/resources/docker/seata
@@ -53,6 +59,13 @@ services:
- 8091
depends_on:
- seata-mysql
+ init:
+ - name: wait-for-mysql
+ image: busybox
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "until nc -z seata-mysql 3306; do sleep 1; done;"
storage-service:
type: app
@@ -72,6 +85,8 @@ services:
depends_on:
- seata-mysql
- seata-server
+ expose:
+ - 20882
account-service:
type: app
@@ -91,6 +106,8 @@ services:
depends_on:
- seata-mysql
- seata-server
+ expose:
+ - 20881
order-service:
type: app
@@ -111,6 +128,8 @@ services:
- seata-mysql
- seata-server
- account-service
+ expose:
+ - 20883
transaction-test:
type: test
diff --git a/test/build-nacos-image.sh b/test/build-nacos-image.sh
deleted file mode 100755
index 567e11fd..00000000
--- a/test/build-nacos-image.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-mkdir nacos-mysql
-curl -o nacos-mysql/Dockerfile
https://raw.githubusercontent.com/nacos-group/nacos-docker/master/example/image/mysql/5.7/Dockerfile
-docker build -t nacos-mysql:5.7 nacos-mysql/
\ No newline at end of file
diff --git a/test/build-test-image.sh b/test/build-test-image.sh
index 35eb93c2..c4564364 100755
--- a/test/build-test-image.sh
+++ b/test/build-test-image.sh
@@ -3,8 +3,11 @@
# Use mirror:
# DEBIAN_MIRROR=http://mirrors.aliyun.com ./build-test-image.sh
+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/dubbo-test-runner/build.sh
-$DIR/build-nacos-image.sh
+docker build -t nacos-mysql:5.7 nacos-mysql/
+
+docker pull busybox
diff --git
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java
index eb61a4cc..628209be 100644
---
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java
+++
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java
@@ -18,8 +18,10 @@
package org.apache.dubbo.scenario.builder;
import
org.apache.dubbo.scenario.builder.exception.ConfigureFileNotFoundException;
+import org.apache.dubbo.scenario.builder.kubernetes.InitContainer;
+import org.apache.dubbo.scenario.builder.kubernetes.KubernetesRunningGenerator;
+import org.apache.dubbo.scenario.builder.kubernetes.KubernetesService;
import org.apache.dubbo.scenario.builder.vo.CaseConfiguration;
-import org.apache.dubbo.scenario.builder.vo.DockerService;
import org.apache.dubbo.scenario.builder.vo.ServiceComponent;
import org.apache.commons.lang3.StringUtils;
@@ -30,6 +32,7 @@ import org.yaml.snakeyaml.Yaml;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -41,6 +44,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
public class ConfigurationImpl implements IConfiguration {
public static final String SAMPLE_TEST_IMAGE = "dubbo/sample-test";
@@ -259,15 +263,22 @@ public class ConfigurationImpl implements IConfiguration {
if (isAppOrTestService(type)) {
service.setImage(SAMPLE_TEST_IMAGE + ":" + testImageVersion);
service.setBasedir(toAbsolutePath(service.getBasedir()));
- if (service.getVolumes() == null) {
- service.setVolumes(new ArrayList<>());
+ if (service.getKubeVolumes() == null) {
+ service.setKubeVolumes(new HashMap<>());
}
- //mount ${project.basedir}/target : DUBBO_APP_DIR
+ // DUBBO_APP_DIR
+ // DUBBO_LOG_DIR
String targetPath = new File(service.getBasedir(),
"target").getCanonicalPath();
- service.getVolumes().add(targetPath + ":" + DUBBO_APP_DIR);
+ service.getKubeVolumes().put("app", targetPath);
+ service.getKubeVolumes().put("log", scenarioLogDir);
+ if (service.getKubeVolumesMounts() == null) {
+ service.setKubeVolumesMounts(new HashMap<>());
+ }
+ // mount ${project.basedir}/target
+ // mount ${scenario_home}/logs :
- //mount ${scenario_home}/logs : DUBBO_LOG_DIR
- service.getVolumes().add(scenarioLogDir + ":" + DUBBO_LOG_DIR);
+ service.getKubeVolumesMounts().put("app", DUBBO_APP_DIR);
+ service.getKubeVolumesMounts().put("log", DUBBO_LOG_DIR);
if (service.getEnvironment() == null) {
service.setEnvironment(new ArrayList<>());
@@ -317,9 +328,11 @@ public class ConfigurationImpl implements IConfiguration {
if (jacocoEnable) {
//mount ${project.basedir}/target : DUBBO_APP_DIR
String jacocoPath = new File(service.getBasedir(),
"target-jacoco").getCanonicalPath();
- service.getVolumes().add(jacocoPath + ":" +
DUBBO_JACOCO_RESULT_DIR);
+ service.getKubeVolumes().put("jacoco",
DUBBO_JACOCO_RESULT_DIR);
+ service.getKubeVolumesMounts().put("jacoco", jacocoPath);
String jacocoRunnerPath = new File(outputDir() +
File.separator + "jacocoagent.jar").getCanonicalPath();
- service.getVolumes().add(jacocoRunnerPath + ":" +
DUBBO_JACOCO_RUNNER_FILE);
+ service.getKubeVolumes().put("jacocoRunner",
DUBBO_JACOCO_RUNNER_FILE);
+ service.getKubeVolumesMounts().put("jacocoRunner",
jacocoRunnerPath);
//set jacoco agent
String jacoco = "-javaagent:" + DUBBO_JACOCO_RUNNER_FILE +
"=destfile=/usr/local/dubbo/target-jacoco/" + index++ + "-" +
System.currentTimeMillis() + "-jacoco.exec";
@@ -359,11 +372,15 @@ public class ConfigurationImpl implements IConfiguration {
service.setHealthcheck(healthcheckMap);
}
Map<String, Object> healthcheck =
service.getHealthcheck();
- healthcheck.putIfAbsent("test", Arrays.asList("CMD",
"/usr/local/dubbo/healthcheck.sh"));
- healthcheck.putIfAbsent("interval", "5s");
- healthcheck.putIfAbsent("timeout", "5s");
- healthcheck.putIfAbsent("retries", 20);
- healthcheck.putIfAbsent("start_period", "60s");
+// healthcheck.putIfAbsent("test", Arrays.asList("CMD",
"/usr/local/dubbo/healthcheck.sh"));
+ healthcheck.putIfAbsent("timeoutSeconds", 10);
+ healthcheck.putIfAbsent("periodSeconds", 5);
+ healthcheck.putIfAbsent("successThreshold", 1);
+ healthcheck.putIfAbsent("failureThreshold", 20);
+ healthcheck.putIfAbsent("initialDelaySeconds", 30);
+
+ List<String> healthcheckExec =
Arrays.asList("/bin/sh", "-c", "/usr/local/dubbo/healthcheck.sh");
+ service.setHealthcheckExec(healthcheckExec);
}
} else if ("test".equals(type)) {
String mainClass = service.getMainClass();
@@ -383,6 +400,28 @@ public class ConfigurationImpl implements IConfiguration {
}
}
+ if (service.getVolumes() != null &&
!service.getVolumes().isEmpty()) {
+ if (service.getKubeVolumes() == null) {
+ service.setKubeVolumes(new HashMap<>());
+ }
+ if (service.getKubeVolumesMounts() == null) {
+ service.setKubeVolumesMounts(new HashMap<>());
+ }
+ for (int i = 0; i < service.getVolumes().size(); i++) {
+ String volume = service.getVolumes().get(i);
+ String[] sp = service.getVolumes().get(i).split(":");
+ if (sp.length != 2) {
+ throw new RuntimeException("Error volume: " + volume);
+ }
+ String key = "dubbo" + i;
+ service.getKubeVolumes().put(key, sp[0]);
+ service.getKubeVolumesMounts().put(key, sp[1]);
+ }
+ for (String volume : service.getVolumes()) {
+
+
+ }
+ }
// set hostname to serviceId if absent
if (StringUtils.isBlank(service.getHostname())) {
service.setHostname(serviceName);
@@ -513,7 +552,7 @@ public class ConfigurationImpl implements IConfiguration {
@Override
public ScenarioRunningScriptGenerator scenarioGenerator() {
- return new DockerComposeRunningGenerator();
+ return new KubernetesRunningGenerator();
}
@Override
@@ -546,7 +585,7 @@ public class ConfigurationImpl implements IConfiguration {
}
@Override
- public String dockerNetworkName() {
+ public String namespaceName() {
return (scenarioName() + "-" + testImageVersion()).toLowerCase();
}
@@ -592,27 +631,26 @@ public class ConfigurationImpl implements IConfiguration {
root.put("scenario_home", scenarioHome());
root.put("scenario_name", scenarioName());
root.put("scenario_version", scenarioVersion());
- root.put("docker_container_name", dockerContainerName());
root.put("jacoco_home", jacocoHome());
root.put("debug_mode", debugMode());
- root.put("docker_compose_file", outputDir() + File.separator +
"docker-compose.yml");
- root.put("network_name", dockerNetworkName());
- root.put("ipv6_cidr", ipv6Cidr());
+ root.put("kubernetes_manifest_file", outputDir() + File.separator +
"kubernetes-manifest.yaml");
+ root.put("namespace_name", namespaceName());
+// root.put("ipv6_cidr", ipv6Cidr());
root.put("timeout", scenarioTimeout);
- final StringBuilder removeImagesScript = new StringBuilder();
- List<String> links = new ArrayList<>();
- if (caseConfiguration.getServices() != null) {
- caseConfiguration.getServices().forEach((name, service) -> {
- links.add(service.getHostname());
- if (service.isRemoveOnExit()) {
- removeImagesScript.append("docker rmi ")
- .append(service.getImage())
- .append(System.lineSeparator());
- }
- });
- }
- root.put("removeImagesScript", removeImagesScript.toString());
+// final StringBuilder removeImagesScript = new StringBuilder();
+// List<String> links = new ArrayList<>();
+// if (caseConfiguration.getServices() != null) {
+// caseConfiguration.getServices().forEach((name, service) -> {
+// links.add(service.getHostname());
+// if (service.isRemoveOnExit()) {
+// removeImagesScript.append("docker rmi ")
+// .append(service.getImage())
+// .append(System.lineSeparator());
+// }
+// });
+// }
+// root.put("removeImagesScript", removeImagesScript.toString());
// add links to test service
// caseConfiguration.getServices().forEach((name, service) -> {
@@ -621,16 +659,19 @@ public class ConfigurationImpl implements IConfiguration {
// service.setLinks(new ArrayList<>());
// }
// for (String link : links) {
-// if (!StringUtils.equals(link, service.getHostname())) {
+// if (!StringUtils.equals(link, service.getHostname())) {[]
// service.getLinks().add(link);
// }
// }
// }
// });
-
- root.put("services", convertDockerServices(scenarioVersion(),
caseConfiguration.getServices()));
+ List<KubernetesService> kubernetesServices =
convertKubernetesService(scenarioVersion(), caseConfiguration.getServices());
+ List<KubernetesService> testServices =
kubernetesServices.stream().filter(s ->
"test".equals(s.getType())).collect(Collectors.toList());
+ kubernetesServices = kubernetesServices.stream().filter(s ->
!"test".equals(s.getType())).collect(Collectors.toList());
+ root.put("services", kubernetesServices);
+ root.put("test_services", testServices);
List<String> testServiceNames =
findTestServiceNames(caseConfiguration);
- root.put("test_service_name", testServiceNames.size() > 0 ?
testServiceNames.get(0) : "");
+ root.put("test_service_names", testServiceNames.size() > 0 ?
testServiceNames : "");
return root;
}
@@ -646,55 +687,108 @@ public class ConfigurationImpl implements IConfiguration
{
return serviceNames;
}
- protected List<DockerService> convertDockerServices(final String version,
- Map<String,
ServiceComponent> componentMap) {
- final ArrayList<DockerService> services = new ArrayList<>();
+ protected List<KubernetesService> convertKubernetesService(final String
version,
+ Map<String,
ServiceComponent> componentMap) {
+ final ArrayList<KubernetesService> services = new ArrayList<>();
if (componentMap == null) {
return services;
}
- componentMap.forEach((name, dependency) -> {
- DockerService service = new DockerService();
-
- String imageName = dependency.getImage();
- service.setName(name);
- service.setImageName(imageName);
- service.setBuild(dependency.getBuild());
- service.setHostname(dependency.getHostname());
- service.setExpose(dependency.getExpose());
- service.setPorts(dependency.getPorts());
- service.setEntrypoint(dependency.getEntrypoint());
- service.setLinks(dependency.getDepends_on());
-
- //convert depends_on to map
- if (dependency.getDepends_on() != null) {
- Map<String, String> dependsOnMap = new LinkedHashMap<>();
- service.setDepends_on(dependsOnMap);
- for (String serviceName : dependency.getDepends_on()) {
- if (healthcheckServices.contains(serviceName)) {
- dependsOnMap.put(serviceName, "{condition:
service_healthy}");
+ for (Map.Entry<String, ServiceComponent> mapEntry :
componentMap.entrySet()) {
+ String name = mapEntry.getKey();
+ ServiceComponent dependency = mapEntry.getValue();
+ KubernetesService service = getKubernetesService(dependency, name);
+ services.add(service);
+ }
+ return services;
+ }
+
+ private static KubernetesService getKubernetesService(ServiceComponent
dependency, String name) {
+ KubernetesService service = new KubernetesService();
+
+ String imageName = dependency.getImage();
+ service.setName(name);
+ service.setImageName(imageName);
+ service.setType(dependency.getType());
+// service.setBuild(dependency.getBuild());
+ service.setHostname(dependency.getHostname());
+ service.setExpose(dependency.getExpose());
+// //convert depends_on to map
+// if (dependency.getDepends_on() != null) {
+// Map<String, String> dependsOnMap = new LinkedHashMap<>();
+// service.setDepends_on(dependsOnMap);
+// for (String serviceName : dependency.getDepends_on()) {
+// if (healthcheckServices.contains(serviceName)) {
+// dependsOnMap.put(serviceName, "{condition:
service_healthy}");
+// } else {
+// dependsOnMap.put(serviceName, "{condition:
service_started}");
+// }
+// }
+// }
+
+ if(dependency.getInit() != null) {
+ Yaml yaml = new Yaml();
+ List<Object> inits = dependency.getInit();
+ for (Object map : inits) {
+ Map<String, Object> initMap = (Map<String, Object>) map;
+ InitContainer initContainer = new InitContainer();
+ Map<String, String> newMap = new LinkedHashMap<>();
+
+ for (Map.Entry<String, Object> entry : initMap.entrySet()) {
+ String key = entry.getKey();
+ if ("command".equals(key)) {
+ initContainer.setCommand((List<String>)
entry.getValue());
+ continue;
+ }
+ String val = yaml.dump(entry.getValue()).trim();
+ if ("name".equals(key)) {
+ initContainer.setName(val);
+ } else if ("image".equals(key)) {
+ initContainer.setImage(val);
} else {
- dependsOnMap.put(serviceName, "{condition:
service_started}");
+ newMap.put(entry.getKey(), val);
}
}
+ initContainer.setAttributes(newMap);
+ List<InitContainer> initContainers =
service.getInitContainers();
+ if (initContainers == null) {
+ service.setInitContainers(new ArrayList<>());
+ initContainers = service.getInitContainers();
+ }
+ initContainers.add(initContainer);
}
- //convert healthcheck to string map
- if (dependency.getHealthcheck() != null) {
- Yaml yaml = new Yaml();
- Map<String, Object> healthcheckMap =
dependency.getHealthcheck();
- Map<String, String> newMap = new LinkedHashMap<>();
- for (Map.Entry<String, Object> entry :
healthcheckMap.entrySet()) {
- String value = yaml.dump(entry.getValue());
- newMap.put(entry.getKey(), value.trim());
+
+ }
+
+ //convert healthcheck to string map
+ if (dependency.getHealthcheck() != null) {
+ Yaml yaml = new Yaml();
+ Map<String, Object> healthcheckMap = dependency.getHealthcheck();
+ Map<String, String> newMap = new LinkedHashMap<>();
+ for (Map.Entry<String, Object> entry : healthcheckMap.entrySet()) {
+ if ("test".equals(entry.getKey())) {
+ dependency.setHealthcheckExec((List<String>)
entry.getValue());
+ continue;
}
- service.setHealthcheck(newMap);
+ String value = yaml.dump(entry.getValue());
+ newMap.put(entry.getKey(), value.trim());
}
- service.setEnvironment(dependency.getEnvironment());
- service.setVolumes(dependency.getVolumes());
- service.setVolumes_from(dependency.getVolumes_from());
- service.setRemoveOnExit(dependency.isRemoveOnExit());
- services.add(service);
- });
- return services;
+ service.setHealthcheck(newMap);
+ service.setHealthcheckExec(dependency.getHealthcheckExec());
+ }
+ if (dependency.getEnvironment() != null) {
+ Map<String, String> env = dependency.getEnvironment().stream()
+ .map(e -> {
+ int index = e.indexOf("=");
+ return new AbstractMap.SimpleEntry<>(e.substring(0,
index), e.substring(index + 1));
+ })
+ .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey,
AbstractMap.SimpleEntry::getValue));
+ service.setEnvironment(env);
+ }
+ service.setVolumes(dependency.getKubeVolumes());
+ service.setVolumesMounts(dependency.getKubeVolumesMounts());
+// service.setVolumes_from(dependency.getVolumes_from());
+// service.setRemoveOnExit(dependency.isRemoveOnExit());
+ return service;
}
}
diff --git
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java
index 9d9c9741..aa107c68 100644
---
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java
+++
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java
@@ -34,7 +34,7 @@ public interface IConfiguration {
String dockerContainerName();
- String dockerNetworkName();
+ String namespaceName();
String testImageVersion();
diff --git
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/InitContainer.java
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/InitContainer.java
new file mode 100644
index 00000000..85cd6396
--- /dev/null
+++
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/InitContainer.java
@@ -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.
+ */
+
+package org.apache.dubbo.scenario.builder.kubernetes;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Such as:
+ * init:
+ * name: wait-for-mysql
+ * image: busybox
+ * command:
+ * - "/bin/sh"
+ * - "-c"
+ * - "until nc -z nacos-mysql 3306; do sleep 1; done;"
+ */
+public class InitContainer {
+
+ private String name;
+
+ private String image;
+
+ private List<String> command;
+
+ private Map<String,String> attributes;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public List<String> getCommand() {
+ return command;
+ }
+
+ public void setCommand(List<String> command) {
+ this.command = command;
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, String> attributes) {
+ this.attributes = attributes;
+ }
+}
diff --git
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/KubernetesRunningGenerator.java
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/KubernetesRunningGenerator.java
new file mode 100644
index 00000000..c7c47268
--- /dev/null
+++
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/KubernetesRunningGenerator.java
@@ -0,0 +1,63 @@
+/*
+ * 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 org.apache.dubbo.scenario.builder.kubernetes;
+
+import org.apache.dubbo.scenario.builder.AbstractRunningGenerator;
+import org.apache.dubbo.scenario.builder.IConfiguration;
+
+import freemarker.template.Configuration;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateExceptionHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.Map;
+
+public class KubernetesRunningGenerator extends AbstractRunningGenerator {
+ private static final Logger LOGGER =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ public KubernetesRunningGenerator() {
+ }
+
+ @Override
+ public void generateAdditionFiles(IConfiguration configuration) {
+ final Map<String, Object> root = configuration.toMap();
+
+ Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
+ try {
+
cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/");
+ cfg.setDefaultEncoding("UTF-8");
+
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
+ cfg.setLogTemplateExceptions(false);
+ cfg.setWrapUncheckedExceptions(true);
+ cfg.setNumberFormat("computer");
+ } catch (Exception e) {
+ // never to do this
+ }
+ try {
+ cfg.getTemplate("kubernetes-manifest.template")
+ .process(root, new FileWriter(new
File(configuration.outputDir(), "kubernetes-manifest.yaml")));
+ } catch (TemplateException | IOException e) {
+ LOGGER.error("", e);
+ }
+ }
+}
diff --git
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/KubernetesService.java
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/KubernetesService.java
new file mode 100644
index 00000000..7f06fded
--- /dev/null
+++
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/kubernetes/KubernetesService.java
@@ -0,0 +1,149 @@
+/*
+ * 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 org.apache.dubbo.scenario.builder.kubernetes;
+
+import java.util.List;
+import java.util.Map;
+
+public class KubernetesService {
+
+ private String type;
+ private String name;
+
+ private String imageName;
+
+ private String hostname;
+
+ private List<String> expose;
+
+ private Map<String, String> healthcheck;
+
+ private List<String> healthcheckExec;
+
+ private Map<String,String> volumesMounts;
+
+ private Map<String,String> volumes;
+
+
+ private Map<String,String> environment;
+
+ private List<InitContainer> initContainers;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getImageName() {
+ return imageName;
+ }
+
+ public void setImageName(String imageName) {
+ this.imageName = imageName;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ public List<String> getExpose() {
+ return expose;
+ }
+
+ public void setExpose(List<String> expose) {
+ this.expose = expose;
+ }
+
+ public Map<String, String> getHealthcheck() {
+ return healthcheck;
+ }
+
+ public void setHealthcheck(Map<String, String> healthcheck) {
+ this.healthcheck = healthcheck;
+ }
+
+ public List<String> getHealthcheckExec() {
+ return healthcheckExec;
+ }
+
+ public void setHealthcheckExec(List<String> healthcheckExec) {
+ this.healthcheckExec = healthcheckExec;
+ }
+
+ public Map<String, String> getVolumesMounts() {
+ return volumesMounts;
+ }
+
+ public void setVolumesMounts(Map<String, String> volumesMounts) {
+ this.volumesMounts = volumesMounts;
+ }
+
+ public Map<String, String> getVolumes() {
+ return volumes;
+ }
+
+ public void setVolumes(Map<String, String> volumes) {
+ this.volumes = volumes;
+ }
+
+ public Map<String, String> getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(Map<String, String> environment) {
+ this.environment = environment;
+ }
+
+ @Override
+ public String toString() {
+ return "KubernetesDeployment{" +
+ "name='" + name + '\'' +
+ ", imageName='" + imageName + '\'' +
+ ", hostname='" + hostname + '\'' +
+ ", expose=" + expose +
+ ", healthcheck=" + healthcheck +
+ ", healthcheckExec=" + healthcheckExec +
+ ", volumesMounts=" + volumesMounts +
+ ", volumes=" + volumes +
+ '}';
+ }
+
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List<InitContainer> getInitContainers() {
+ return initContainers;
+ }
+
+ public void setInitContainers(List<InitContainer> initContainers) {
+ this.initContainers = initContainers;
+ }
+}
diff --git
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java
index efc02934..91479ca0 100644
---
a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java
+++
b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java
@@ -18,6 +18,8 @@
package org.apache.dubbo.scenario.builder.vo;
+import org.apache.dubbo.scenario.builder.kubernetes.InitContainer;
+
import java.util.List;
import java.util.Map;
@@ -33,11 +35,18 @@ public class ServiceComponent {
private List<String> ports;
private List<String> entrypoint;
private List<String> environment;
- private List<String> volumes;
+ private Map<String,String> kubeVolumes;
+
+ private Map<String,String> kubeVolumesMounts;
private List<String> volumes_from;
private List<String> depends_on;
private Map<String, Object> healthcheck;
+ private List<Object> init;
+
+
+ private List<String> healthcheckExec;
+
// app attrs
private String type;
private String basedir;
@@ -51,6 +60,8 @@ public class ServiceComponent {
private List<String> systemProps;
private List<String> jvmFlags;
+ private List<String> volumes;
+
public String getImage() {
return image;
}
@@ -211,12 +222,12 @@ public class ServiceComponent {
this.jvmFlags = jvmFlags;
}
- public List<String> getVolumes() {
- return volumes;
+ public Map<String, String> getKubeVolumes() {
+ return kubeVolumes;
}
- public void setVolumes(List<String> volumes) {
- this.volumes = volumes;
+ public void setKubeVolumes(Map<String, String> kubeVolumes) {
+ this.kubeVolumes = kubeVolumes;
}
public List<String> getVolumes_from() {
@@ -264,7 +275,7 @@ public class ServiceComponent {
", ports=" + ports +
", entrypoint=" + entrypoint +
", environment=" + environment +
- ", volumes=" + volumes +
+ ", volumes=" + kubeVolumes +
", volumes_from=" + volumes_from +
", depends_on=" + depends_on +
", healthcheck=" + healthcheck +
@@ -281,4 +292,38 @@ public class ServiceComponent {
", jvmFlags=" + jvmFlags +
'}';
}
+
+ public Map<String, String> getKubeVolumesMounts() {
+ return kubeVolumesMounts;
+ }
+
+ public void setKubeVolumesMounts(Map<String, String> kubeVolumesMounts) {
+ this.kubeVolumesMounts = kubeVolumesMounts;
+ }
+
+ public List<String> getHealthcheckExec() {
+ return healthcheckExec;
+ }
+
+ public void setHealthcheckExec(List<String> healthcheckExec) {
+ this.healthcheckExec = healthcheckExec;
+ }
+
+ public List<String> getVolumes() {
+ return volumes;
+ }
+
+ public void setVolumes(List<String> volumes) {
+ this.volumes = volumes;
+ }
+
+
+ public List<Object> getInit() {
+ return init;
+ }
+
+ public void setInit( List<Object> init) {
+ this.init = init;
+ }
+
}
diff --git
a/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml
b/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml
index eccfb551..b1b348dc 100644
---
a/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml
+++
b/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml
@@ -38,12 +38,15 @@ services:
basedir: ${project_dir}
mainClass: ${main_class}
systemProps:
- - zookeeper.address=${project_name}
+ - zookeeper.address=127.0.0.1
- zookeeper.port=${zookeeper_port}
checkPorts:
- ${zookeeper_port}
- ${dubbo_port}
checkLog: ${check_log}
+ expose:
+ - ${dubbo_port}
+ - ${zookeeper_port}
${project_name}-test:
type: test
diff --git
a/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml
b/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml
index 50e960eb..b22351b1 100644
---
a/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml
+++
b/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml
@@ -35,6 +35,8 @@ props:
services:
zookeeper:
image: zookeeper:${zookeeper_version}
+ expose:
+ - 2181
${project_name}:
type: app
@@ -48,6 +50,8 @@ services:
checkPorts:
- ${dubbo_port}
checkLog: ${check_log}
+ expose:
+ - ${dubbo_port}
${project_name}-test:
type: test
diff --git
a/test/dubbo-scenario-builder/src/main/resources/kubernetes-manifest.template
b/test/dubbo-scenario-builder/src/main/resources/kubernetes-manifest.template
new file mode 100644
index 00000000..a3b01c92
--- /dev/null
+++
b/test/dubbo-scenario-builder/src/main/resources/kubernetes-manifest.template
@@ -0,0 +1,187 @@
+<#--
+ ~ 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.
+-->
+
+apiVersion: v1
+kind: Namespace
+metadata:
+ name: ${namespace_name}
+
+---
+
+
+
+<#list services as service>
+apiVersion: v1
+kind: Service
+metadata:
+ namespace: ${namespace_name}
+ name: ${service.name}
+spec:
+ clusterIP: None
+ selector:
+ app: ${service.name}
+ ports:
+ <#if service.expose??>
+ <#list service.expose as expose>
+ - name: service-${expose}
+ protocol: TCP
+ port: ${expose}
+ targetPort: ${expose}
+ </#list>
+ </#if>
+
+
+---
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ namespace: ${namespace_name}
+ name: ${service.name}
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: ${service.name}
+ template:
+ metadata:
+ namespace: ${namespace_name}
+ labels:
+ app: ${service.name}
+ spec:
+ <#if service.initContainers??>
+ initContainers:
+ <#list service.initContainers as initContainer>
+ - name: ${initContainer.name}
+ image: ${initContainer.image}
+ <#if initContainer.command??>
+ command:
+ <#list initContainer.command as cmd>
+ - "${cmd}"
+ </#list>
+ </#if>
+ <#if initContainer.attributes??>
+ <#list initContainer.attributes as key,value>
+ ${key}: ${value}
+ </#list>
+ </#if>
+ </#list>
+ </#if>
+ containers:
+ - name: ${service.name}
+ <#if service.imageName?has_content>
+ image: ${service.imageName}
+ </#if>
+ imagePullPolicy: IfNotPresent
+ securityContext:
+ privileged: true
+ ports:
+ <#if service.expose??>
+ <#list service.expose as expose>
+ - containerPort: ${expose}
+ </#list>
+ </#if>
+ <#if service.volumes??>
+ volumeMounts:
+ <#list service.volumesMounts as key,value>
+ - name: ${key}-volume
+ mountPath: ${value}
+ </#list>
+ </#if>
+ <#if service.environment??>
+ env:
+ <#list service.environment as key,value>
+ - name: ${key}
+ value: "${value}"
+ </#list>
+ </#if>
+ <#if service.healthcheck??>
+ readinessProbe:
+ exec:
+ command:
+ <#if service.healthcheckExec??>
+ <#list service.healthcheckExec as cmd>
+ - "${cmd}"
+ </#list>
+ </#if>
+ <#list service.healthcheck as key,value>
+ ${key}: ${value}
+ </#list>
+ </#if>
+ <#if service.volumes??>
+ volumes:
+ <#list service.volumes as key,value>
+ - name: ${key}-volume
+ hostPath:
+ path: ${value}
+ </#list>
+ </#if>
+
+---
+</#list>
+
+<#list test_services as test_service>
+apiVersion: batch/v1
+kind: Job
+metadata:
+ namespace: ${namespace_name}
+ name: ${test_service.name}
+spec:
+ backoffLimit: 0
+ template:
+ metadata:
+ namespace: ${namespace_name}
+ labels:
+ app: ${test_service.name}
+ spec:
+ containers:
+ - name: ${test_service.name}
+ <#if test_service.imageName?has_content>
+ image: ${test_service.imageName}
+ </#if>
+ imagePullPolicy: IfNotPresent
+ #ports:
+ #<#if test_service.expose??>
+ #<#list test_service.expose as expose>
+ # - containerPort: ${expose}
+ #</#list>
+ #</#if>
+ <#if test_service.volumes??>
+ volumeMounts:
+ <#list test_service.volumesMounts as key,value>
+ - name: ${key}-volume
+ mountPath: ${value}
+ </#list>
+ </#if>
+ <#if test_service.environment??>
+ env:
+ <#list test_service.environment as key,value>
+ - name: ${key}
+ value: "${value}"
+ </#list>
+ </#if>
+ restartPolicy: Never
+ <#if test_service.volumes??>
+ volumes:
+ <#list test_service.volumes as key,value>
+ - name: ${key}-volume
+ hostPath:
+ path: ${value}
+ </#list>
+ </#if>
+---
+</#list>
diff --git a/test/dubbo-scenario-builder/src/main/resources/scenario.sh
b/test/dubbo-scenario-builder/src/main/resources/scenario.sh
index e39f3101..3adcd364 100644
--- a/test/dubbo-scenario-builder/src/main/resources/scenario.sh
+++ b/test/dubbo-scenario-builder/src/main/resources/scenario.sh
@@ -31,21 +31,31 @@ debug_mode=${debug_mode}
timeout=${timeout}
scenario_name=${scenario_name}
scenario_version=${scenario_version}
-compose_file="${docker_compose_file}"
+compose_file="${kubernetes_manifest_file}"
project_name=$(echo "${scenario_name}_${scenario_version}" |sed -e "s/\.//g"
|awk '{print tolower($0)}')
-test_service_name="${test_service_name}_1"
-network_name="${network_name}"
+namespace_name="${namespace_name}"
service_names=( \
<#list services as service>
"${service.name}" \
</#list>
- )
+<#list test_services as service>
+ "${service.name}" \
+</#list>
+)
+
+test_service_names=(\
+<#list test_services as service>
+ "${service.name}" \
+</#list>
+)
-service_size=${services?size}
+test_service_size=${test_services?size}
+service_size=$(expr ${services?size} + $test_service_size)
export service_names=$service_names
export service_size=$service_size
+export test_service_size=$test_service_size
<#noparse>
function redirect_all_container_logs() {
@@ -64,7 +74,7 @@ function redirect_all_container_logs() {
if [ "$redirect_count" == $service_size ];then
echo "Redirect all containers logs." >> $scenario_log
- break
+ return
fi
sleep 3
@@ -73,64 +83,86 @@ function redirect_all_container_logs() {
function redirect_container_logs() {
service_name=$1
- container_name=${project_name}_${service_name}_1
- # only redirect once
- ps -ef | grep "docker logs -f $container_name" | grep -v grep > /dev/null
- result=$?
- if [ $result -eq 0 ]; then
+ pod_name=$(kubectl get pod -l app=${service_name} -o
jsonpath='{.items[0].metadata.name}' -n ${namespace_name} 2>/dev/null)
+ if [ -z "$pod_name" ]; then
+ return 1
+ fi
+ # Check if logs are already being redirected
+ if kubectl logs $pod_name &>/dev/null; then
return 0
fi
- container_id=`docker ps -aqf "name=${container_name}"`
- if [[ -z "${container_id}" ]]; then
+ # Check if the pod is still in ContainerCreating state
+ pod_status=$(kubectl get pod $pod_name -n ${namespace_name} -o
jsonpath='{.status.phase}' 2>/dev/null)
+ kubectl describe pod -l app=${service_name} -n ${namespace_name}
+ if [ "$pod_status" == "Pending" ]; then
+ echo "Pod $pod_name is still in Pending state. Cannot redirect logs."
return 1
fi
- echo "Redirect container logs: $container_name" >> $scenario_log
+ # Redirect container logs to a file
+ echo "Redirect container logs for pod $pod_name" >> $scenario_log
if [ "$debug_mode" == "1" ]; then
- # redirect container logs to file and display debug message
- docker logs -f $container_name 2>&1 | tee
$SCENARIO_HOME/logs/${service_name}.log | grep "dt_socket" &
+ # Redirect with debug message
+ kubectl logs -f $pod_name -n ${namespace_name} 2>&1 | tee
$SCENARIO_HOME/logs/${service_name}.log | grep "dt_socket" &
else
- docker logs -f $container_name &> $SCENARIO_HOME/logs/${service_name}.log &
+ kubectl logs -f $pod_name -n ${namespace_name} &>
$SCENARIO_HOME/logs/${service_name}.log &
fi
return 0
+}
+
+function wait_pods_completion() {
+ test_pod_names=$1
+ start=$2
+ timeout=$3
+ job_pids=()
+ for test_pod_name in "${test_pod_names[@]}"; do
+ # Start the wait_pod_completion function as a background job
+ wait_pod_completion "$test_pod_name" "$start" "$timeout" &
+
+ # Store the background job PID
+ job_pids+=($!)
+ done
+
+ # Wait for all background jobs to finish
+ for job_pid in "${job_pids[@]}"; do
+ wait "$job_pid"
+ test_results+=($?)
+ done
+ result=0
+ for test_result in "${test_results[@]}"; do
+ if [[ "$test_result" -ne 0 ]]; then
+ result=1
+ break
+ fi
+ done
+ return $result
}
-function wait_container_exit() {
- container_name=$1
+function wait_pod_completion() {
+ test_pod_name=$1
start=$2
timeout=$3
- # check and get exit code
+ # Check and wait for pod completion
while [ 1 = 1 ];
do
sleep 2
duration=$(( SECONDS - start ))
- if [ $duration -gt $timeout ];then
- echo "wait for container is timeout: $duration s"
+ if [ $duration -gt $timeout ]; then
+ echo "Waiting for job is timeout: $duration s"
return 1
fi
- container_id=`docker ps -aqf "name=${container_name}"`
- if [[ -z "${container_id}" ]]; then
- continue
+ pod_status=$(kubectl get job ${test_service_name} -o
jsonpath='{.status.conditions[0].type}' -n ${namespace_name} 2>/dev/null)
+ if [[ "$pod_status" == "Complete" || "$pod_status" == "Failed" ]]; then
+ return 0
fi
-
- status=`docker inspect $container_name --format='{{.State.Status}}'`
- # test container may pending start cause by depends_on condition
-# result=$?
-# if [ $result -ne 0 ];then
-# echo "check container status failure: $result"
-# return 1
-# fi
- if [ "$status" == "exited" ];then
- return 0
- fi
-
done
}
+
status=1
mkdir -p ${SCENARIO_HOME}/logs
@@ -140,89 +172,97 @@ rm -f $scenario_log
echo "[$scenario_name] debug_mode: $debug_mode" >> $scenario_log
echo "[$scenario_name] timeout: $timeout" >> $scenario_log
-#Starting test containers
-container_name="${project_name}_${test_service_name}"
+cat ${compose_file}
+apt-get install -y tree
+tree
/home/runner/work/dubbo-samples/dubbo-samples/99-integration/dubbo-samples-registry-test-curator/target
-#kill and clean first
-echo "[$scenario_name] Killing containers .." | tee -a $scenario_log
-docker-compose -p ${project_name} -f ${compose_file} kill 2>&1 | tee -a
$scenario_log > /dev/null
+#Delete the resources in Kubernetes-manifest first.
+echo "[$scenario_name] Deleting resources .." | tee -a $scenario_log
+kubectl delete -f ${compose_file} --grace-period=0 --force 2>&1 | tee -a
$scenario_log > /dev/null
-echo "[$scenario_name] Removing containers .." | tee -a $scenario_log
-docker-compose -p ${project_name} -f ${compose_file} rm -f 2>&1 | tee -a
$scenario_log > /dev/null
+# start time
+start=$SECONDS
-# pull images
-# TODO check pull timeout?
-#pull_time=$SECONDS
-#echo "[$scenario_name] Pulling images .." | tee -a $scenario_log
-#docker-compose -p ${project_name} -f ${compose_file} pull
--ignore-pull-failures 2>&1 <<< "NNN" | tee -a $scenario_log > /dev/null
-#echo "Pull images cost: $((SECONDS - pull_time)) s"
+# Apply Kubernetes manifest
+echo "[$scenario_name] Creating resources .." | tee -a $scenario_log
+kubectl apply -f ${compose_file} 2>&1 | tee -a $scenario_log > /dev/null
+
+sleep 8
-#run async, cause depends_on service healthy blocking docker-compose up
redirect_all_container_logs &
-# start time
-start=$SECONDS
+# Initialize an empty array to store test_pod_names
+test_pod_names=()
+for test_service_name in ${test_service_names[@]}; do
-# complete pull fail interactive by <<< "NN"
-echo "[$scenario_name] Starting containers .." | tee -a $scenario_log
-docker-compose -p ${project_name} -f ${compose_file} up -d 2>&1 <<< "NNN" |
tee -a $scenario_log > /dev/null
-
-sleep 5
-
-# test container may pending start cause by depends_on condition
-#container_id=`docker ps -aqf "name=${container_name}"`
-#if [[ -z "${container_id}" ]]; then
-# echo "[$scenario_name] docker startup failure!" | tee -a $scenario_log
-# status=1
-#else
- echo "[$scenario_name] Waiting for test container .." | tee -a
$scenario_log
- # check and get exit code
- wait_container_exit ${container_name} $start $timeout
- result=$?
- if [ $result -eq 0 ]; then
- result=`docker inspect ${container_name}
--format='{{.State.ExitCode}}'`
- if [ $result -eq 0 ]; then
- status=0
- echo "[$scenario_name] Run tests successfully" | tee -a
$scenario_log
- else
- status=$result
- echo "[$scenario_name] $ERROR_MSG_FLAG Run tests failed" | tee -a
$scenario_log
- fi
+ test_pod_name=$(kubectl get pod -l app=${test_service_name} -o
jsonpath='{.items[0].metadata.name}' -n ${namespace_name} 2> /dev/null)
+ if [ -z "$test_pod_name" ]; then
+ echo "[$scenario_name] Test Pod $test_service_name not found" | tee -a
$scenario_log
+ exit 1
+ fi
+ # Add test_pod_name to the test_pod_names array
+ test_pod_names+=("$test_pod_name")
+done
+
+echo "Test Pod Names: ${test_pod_names[@]}"
+
+echo "[$scenario_name] Waiting for test pod .." | tee -a $scenario_log
+wait_pods_completion $test_pod_names $start $timeout
+result=$?
+if [ $result -eq 0 ]; then
+ succeeded_count=0
+ for test_service_name in "${test_service_names[@]}"; do
+ test_succeeded=$(kubectl get job "$test_service_name" -o
jsonpath='{.status.succeeded}' -n "$namespace_name" 2> /dev/null)
+ if [ -z "$test_succeeded" ]; then
+ test_succeeded=0
+ fi
+ succeeded_count=$((succeeded_count + test_succeeded))
+ done
+
+ if [ "$succeeded_count" -eq $test_service_size ]; then
+ status=0
+ echo "[$scenario_name] Run tests successfully" | tee -a $scenario_log
else
status=1
- echo "[$scenario_name] $ERROR_MSG_FLAG Run tests timeout" | tee -a
$scenario_log
+ echo "[$scenario_name] $ERROR_MSG_FLAG Run tests failed" | tee -a
$scenario_log
fi
- if [[ "$debug_mode" == "1" ]]; then
- echo "[$scenario_name] Waiting for debugging .." | tee -a $scenario_log
- echo "[$scenario_name] Please type 'Ctrl + C' or run the script
'./kill-tests.sh' to end debugging .." | tee -a $scenario_log
- # idle waiting for abort from user
- read -r -d '' _ </dev/tty
- fi
+else
+ status=1
+ echo "[$scenario_name] $ERROR_MSG_FLAG Run tests timeout" | tee -a
$scenario_log
+fi
+
+# TODO: Handle debugging in Kubernetes (if needed)
+# if [[ "$debug_mode" == "1" ]]; then
+# echo "[$scenario_name] Waiting for debugging .." | tee -a $scenario_log
+# echo "[$scenario_name] Please debug the pod using 'kubectl exec' or
other tools .." | tee -a $scenario_log
+# echo "[$scenario_name] Please type 'Ctrl + C' or run the script
'./kill-tests.sh' to end debugging .." | tee -a $scenario_log
+# Implement interactive debugging logic if needed
+# fi
- echo "[$scenario_name] Stopping containers .." | tee -a $scenario_log
- docker-compose -p ${project_name} -f ${compose_file} kill 2>&1 | tee -a
$scenario_log > /dev/null
-#fi
-if [[ $status == 0 ]];then
- docker-compose -p $project_name -f $compose_file rm -f 2>&1 | tee -a
$scenario_log > /dev/null
- ${removeImagesScript}
+
+if [[ $status == 0 ]]; then
+ echo "[$scenario_name] Deleting resources .." | tee -a $scenario_log
+ kubectl delete -f ${compose_file} --grace-period=0 --force 2>&1 | tee -a
$scenario_log > /dev/null
else
- for service_name in ${service_names[@]};do
- service_container_name=${project_name}_${service_name}_1
- docker wait $service_container_name > /dev/null
+ for service_name in ${service_names[@]}; do
+ service_pod_name=$(kubectl get pod -l app=${service_name} -o
jsonpath='{.items[0].metadata.name}' -n ${namespace_name} 2>&1 > /dev/null)
+
+ if [ -n "$service_pod_name" ]; then
+ kubectl wait pod $service_pod_name --for=delete > /dev/null
- echo "docker inspect $service_container_name :" >> $scenario_log
- docker inspect $service_container_name >> $scenario_log
- echo "" >> $scenario_log
+ echo "kubectl describe pod $service_pod_name -n ${namespace_name}
:" >> $scenario_log
+ kubectl describe pod $service_pod_name -n ${namespace_name}>>
$scenario_log
+ echo "" >> $scenario_log
- docker logs -f $service_container_name &>
$SCENARIO_HOME/logs/${service_name}.log
+ kubectl logs -f $service_pod_name -n ${namespace_name} >
$SCENARIO_HOME/logs/${service_name}.log
+ fi
done
+ echo "[$scenario_name] Deleting resources .." | tee -a $scenario_log
+ kubectl delete -f ${compose_file} --grace-period=0 --force 2>&1 | tee -a
$scenario_log > /dev/null
fi
-# rm network
-docker network rm $network_name 2>&1 | tee -a $scenario_log > /dev/null
-
exit $status
</#noparse>
\ No newline at end of file
diff --git a/test/dubbo-test-runner/src/docker/Dockerfile
b/test/dubbo-test-runner/src/docker/Dockerfile
index 64a1d5d6..387933da 100644
--- a/test/dubbo-test-runner/src/docker/Dockerfile
+++ b/test/dubbo-test-runner/src/docker/Dockerfile
@@ -24,6 +24,7 @@ RUN if [ -n "$DEBIAN_MIRROR" ]; then \
RUN apt-get update && \
apt-get install -y telnet && \
+ apt-get install -y tree && \
rm -rf /var/lib/apt/lists/*
VOLUME /usr/local/dubbo/app /usr/local/dubbo/logs
diff --git a/test/dubbo-test-runner/src/docker/run-dubbo-app.sh
b/test/dubbo-test-runner/src/docker/run-dubbo-app.sh
index 12fda3f9..3089d781 100755
--- a/test/dubbo-test-runner/src/docker/run-dubbo-app.sh
+++ b/test/dubbo-test-runner/src/docker/run-dubbo-app.sh
@@ -28,6 +28,7 @@ if [ $RUN_DELAY -gt 0 ]; then
fi
echo "Running app : [$APP_MAIN_CLASS] ..."
+tree /usr/local/dubbo/app
start=$SECONDS
java $JAVA_OPTS $DEBUG_OPTS -cp "$APP_CLASSES_DIR:$APP_DEPENDENCY_DIR/*"
$APP_MAIN_CLASS 2>&1 &
pid=$!
diff --git a/test/nacos-mysql/Dockerfile b/test/nacos-mysql/Dockerfile
new file mode 100644
index 00000000..4d691a2c
--- /dev/null
+++ b/test/nacos-mysql/Dockerfile
@@ -0,0 +1,5 @@
+FROM mysql:5.7.40
+ADD
https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql
/docker-entrypoint-initdb.d/nacos-mysql.sql
+RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
+EXPOSE 3306
+CMD ["mysqld", "--character-set-server=utf8mb4",
"--collation-server=utf8mb4_unicode_ci","--bind-address=0.0.0.0"]
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]