You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/10/05 12:32:14 UTC

[shenyu] branch master updated: enable log to console and test with pg (#4026)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 6bfb86bd0 enable log to console and test with pg (#4026)
6bfb86bd0 is described below

commit 6bfb86bd0bd20ace326fc495959c040450175eb3
Author: Luke.Z <10...@users.noreply.github.com>
AuthorDate: Wed Oct 5 20:32:03 2022 +0800

    enable log to console and test with pg (#4026)
---
 .github/workflows/e2e.yaml                         | 30 +++++++++++++---------
 shenyu-e2e/pom.xml                                 |  2 +-
 shenyu-e2e/script/storage_init.sh                  |  4 +--
 shenyu-e2e/script/storage_init_mysql.sh            | 11 ++++++--
 ...init_postgresql.sh => storage_init_postgres.sh} | 11 ++++++--
 ...-compose.pg.yml => docker-compose.postgres.yml} |  6 -----
 .../shenyu/e2e/client/admin/AdminClientTest.java   |  3 ++-
 .../src/test/resources/docker-compose.yml          |  2 +-
 8 files changed, 42 insertions(+), 27 deletions(-)

diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index c21cf9fd0..1a6d5d5df 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -40,16 +40,6 @@ jobs:
         with:
           submodules: true
 
-      - name: Set up JDK 11 for Compiling ShenYu E2E Egnine
-        uses: actions/setup-java@v3
-        with:
-          java-version: '11'
-          distribution: 'temurin'
-          cache: maven
-
-      - name: Build shenyu-e2e-engine with Maven
-        run: ./mvnw -B -f ./shenyu-e2e/pom.xml -am -pl shenyu-e2e-engine clean install
-
       - name: Set up JDK 8 for Building ShenYu
         uses: actions/setup-java@v3
         with:
@@ -81,6 +71,22 @@ jobs:
           tags: shenyu/bootstrap:latest
           outputs: type=docker,dest=/tmp/apache-shenyu-bootstrap.tar
 
+      - name: Load ShenYu Docker Images
+        run: |
+          docker load --input /tmp/apache-shenyu-admin.tar
+          docker load --input /tmp/apache-shenyu-bootstrap.tar
+          docker image ls -a
+
+      - name: Set up JDK 11 for Compiling ShenYu E2E Egnine
+        uses: actions/setup-java@v3
+        with:
+          java-version: '11'
+          distribution: 'temurin'
+          cache: maven
+
+      - name: Build shenyu-e2e-engine with Maven
+        run: ./mvnw -B -f ./shenyu-e2e/pom.xml -am -pl shenyu-e2e-engine clean install
+
       - name: Upload Docker Image Artifacts
         uses: actions/upload-artifact@v3
         with:
@@ -93,7 +99,7 @@ jobs:
     needs: [ "build-docker-images" ]
     strategy:
       matrix:
-        storage: [ "h2", "mysql" ]
+        storage: [ "h2", "mysql", "postgres" ]
     steps:
       - uses: actions/download-artifact@v3
         with:
@@ -122,4 +128,4 @@ jobs:
           storage: ${{ matrix.storage }}
         run: |
           bash ./shenyu-e2e/script/storage_init.sh
-          ./mvnw -B -f ./shenyu-e2e/pom.xml -am -pl shenyu-e2e-case -Dstorage=${{ matrix.storage }} test
+          ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case -Dstorage=${{ matrix.storage }} test
diff --git a/shenyu-e2e/pom.xml b/shenyu-e2e/pom.xml
index ec2770264..4e41bb1d1 100644
--- a/shenyu-e2e/pom.xml
+++ b/shenyu-e2e/pom.xml
@@ -250,7 +250,7 @@
                 <configuration>
                     <reportFormat>plain</reportFormat>
                     <consoleOutputReporter>
-                        <disable>true</disable>
+                        <disable>false</disable>
                     </consoleOutputReporter>
                     <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter"/>
                 </configuration>
diff --git a/shenyu-e2e/script/storage_init.sh b/shenyu-e2e/script/storage_init.sh
index 70391e31c..9f2188223 100644
--- a/shenyu-e2e/script/storage_init.sh
+++ b/shenyu-e2e/script/storage_init.sh
@@ -18,6 +18,6 @@
 
 HOME="$(cd "$(dirname $0)"; pwd)"
 
-if [[ "$storage" == "mysql" ]]; then
-  bash ${HOME}/storage_init_mysql.sh
+if [[ "$storage" != "h2" ]]; then
+  bash ${HOME}/storage_init_${storage}.sh
 fi
diff --git a/shenyu-e2e/script/storage_init_mysql.sh b/shenyu-e2e/script/storage_init_mysql.sh
index d430dc226..097e02fde 100644
--- a/shenyu-e2e/script/storage_init_mysql.sh
+++ b/shenyu-e2e/script/storage_init_mysql.sh
@@ -18,7 +18,14 @@
 
 mkdir -p /tmp/shenyu-e2e/mysql
 
-wget -O /tmp/shenyu-e2e/mysql/mysql-connector.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.29/mysql-connector-java-8.0.29.jar
-wget -O /tmp/shenyu-e2e/mysql/schema.sql https://raw.githubusercontent.com/apache/shenyu/master/db/init/mysql/schema.sql
+wget -O /tmp/shenyu-e2e/mysql/mysql-connector.jar \
+  https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.29/mysql-connector-java-8.0.29.jar || \
+  wget -O /tmp/shenyu-e2e/mysql/mysql-connector.jar \
+    https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.29/mysql-connector-java-8.0.29.jar
+
+wget -O /tmp/shenyu-e2e/mysql/schema.sql \
+  https://raw.githubusercontent.com/apache/shenyu/master/db/init/mysql/schema.sql || \
+  wget -O /tmp/shenyu-e2e/mysql/schema.sql \
+    https://raw.githubusercontent.com/apache/shenyu/master/db/init/mysql/schema.sql
 
 echo "GRANT ALL PRIVILEGES ON shenyu.* TO 'shenyue2e'@'%';" >> /tmp/shenyu-e2e/mysql/schema.sql
diff --git a/shenyu-e2e/script/storage_init_postgresql.sh b/shenyu-e2e/script/storage_init_postgres.sh
similarity index 63%
rename from shenyu-e2e/script/storage_init_postgresql.sh
rename to shenyu-e2e/script/storage_init_postgres.sh
index d69de8a17..d25f423e5 100644
--- a/shenyu-e2e/script/storage_init_postgresql.sh
+++ b/shenyu-e2e/script/storage_init_postgres.sh
@@ -18,5 +18,12 @@
 
 mkdir -p /tmp/shenyu-e2e/pg
 
-wget -O /tmp/shenyu-e2e/pg/create-table.sql https://raw.githubusercontent.com/apache/shenyu/master/db/init/pg/create-table.sql
-wget -O /tmp/shenyu-e2e/pg/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.5.0.jar
+wget -O /tmp/shenyu-e2e/pg/create-table.sql \
+  https://raw.githubusercontent.com/apache/shenyu/master/db/init/pg/create-table.sql || \
+  wget -O /tmp/shenyu-e2e/pg/create-table.sql \
+  https://raw.githubusercontent.com/apache/shenyu/master/db/init/pg/create-table.sql
+
+wget -O /tmp/shenyu-e2e/pg/postgresql.jar \
+  https://jdbc.postgresql.org/download/postgresql-42.5.0.jar || \
+  wget -O /tmp/shenyu-e2e/pg/postgresql.jar \
+  https://jdbc.postgresql.org/download/postgresql-42.5.0.jar
diff --git a/shenyu-e2e/shenyu-e2e-case/src/test/resources/docker-compose.pg.yml b/shenyu-e2e/shenyu-e2e-case/src/test/resources/docker-compose.postgres.yml
similarity index 94%
rename from shenyu-e2e/shenyu-e2e-case/src/test/resources/docker-compose.pg.yml
rename to shenyu-e2e/shenyu-e2e-case/src/test/resources/docker-compose.postgres.yml
index d2a8ed15e..5b122152d 100644
--- a/shenyu-e2e/shenyu-e2e-case/src/test/resources/docker-compose.pg.yml
+++ b/shenyu-e2e/shenyu-e2e-case/src/test/resources/docker-compose.postgres.yml
@@ -22,8 +22,6 @@ services:
     image: shenyu/admin:latest
     expose:
       - 9095
-    ports:
-      - 9095:9095
     volumes:
       - /tmp/shenyu-e2e/pg/postgresql.jar:/opt/shenyu-admin/ext-lib/postgresql.jar
     environment:
@@ -41,8 +39,6 @@ services:
       - shenyu.sync.websocket.urls=ws://admin:9095/websocket
     expose:
       - 9095
-    ports:
-      - 9195:9195
 
   httpbin:
     image: kennethreitz/httpbin:latest
@@ -53,8 +49,6 @@ services:
     image: postgres:14
     expose:
       - 5432
-    ports:
-      - 5432:5432
     environment:
       - POSTGRES_USER=shenyue2e
       - POSTGRES_PASSWORD=123456
diff --git a/shenyu-e2e/shenyu-e2e-client/src/test/java/org/apache/shenyu/e2e/client/admin/AdminClientTest.java b/shenyu-e2e/shenyu-e2e-client/src/test/java/org/apache/shenyu/e2e/client/admin/AdminClientTest.java
index c51ce1315..fd1b44580 100644
--- a/shenyu-e2e/shenyu-e2e-client/src/test/java/org/apache/shenyu/e2e/client/admin/AdminClientTest.java
+++ b/shenyu-e2e/shenyu-e2e-client/src/test/java/org/apache/shenyu/e2e/client/admin/AdminClientTest.java
@@ -37,6 +37,7 @@ import org.apache.shenyu.e2e.matcher.SelectorMatcher;
 import org.assertj.core.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.MethodOrderer;
 import org.junit.jupiter.api.Order;
 import org.junit.jupiter.api.Test;
@@ -57,7 +58,7 @@ import java.util.stream.Collectors;
 public class AdminClientTest {
     static AdminClient client;
     
-    static GenericContainer<?> container = new GenericContainer<>("ghcr.io/apache/shenyu/admin:latest")
+    static GenericContainer<?> container = new GenericContainer<>("shenyu/admin:latest")
             .withExposedPorts(9095)
             .withLogConsumer(new Slf4jLogConsumer(log));
     
diff --git a/shenyu-e2e/shenyu-e2e-engine/src/test/resources/docker-compose.yml b/shenyu-e2e/shenyu-e2e-engine/src/test/resources/docker-compose.yml
index d2773386b..d2b70dca1 100644
--- a/shenyu-e2e/shenyu-e2e-engine/src/test/resources/docker-compose.yml
+++ b/shenyu-e2e/shenyu-e2e-engine/src/test/resources/docker-compose.yml
@@ -19,6 +19,6 @@ version: '2.3'
 
 services:
   admin:
-    image: ghcr.io/apache/shenyu/admin:latest
+    image: shenyu/admin:latest
     ports:
       - "19095:9095"