You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/01/05 03:06:09 UTC

[shardingsphere] branch master updated: add agent zipkin E2E environment files (#23334)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 372c93a49c0 add agent zipkin E2E environment files (#23334)
372c93a49c0 is described below

commit 372c93a49c0c8f6b0ed1b18d07f5e6f9077f2ac1
Author: 孙念君 Nianjun Sun <su...@apache.org>
AuthorDate: Thu Jan 5 11:06:03 2023 +0800

    add agent zipkin E2E environment files (#23334)
    
    * Refactor : refactor the docker related files (#23135)
    
    * Refactor : update the assembly file for zipkin E2E (#23135)
    
    * Add : add docker-compose related file for zipkin (#23135)
---
 ...ngsphere-proxy-agent-opentelemetry-assembly.xml | 13 +++++++--
 test/e2e/agent/plugins/zipkin/Dockerfile           |  4 +--
 test/e2e/agent/plugins/zipkin/pom.xml              | 32 ++++++++++++++++++++--
 .../plugins/zipkin/src/test/assembly/bin/start.sh  |  2 +-
 ...sphere-proxy-agent-tracing-zipkin-assembly.xml} | 22 ++++++++++++---
 .../test/resources/docker/agent/conf/agent.yaml    |  2 +-
 .../src/test/resources/docker/docker-compose.yml   |  5 ++--
 7 files changed, 64 insertions(+), 16 deletions(-)

diff --git a/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml b/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
index 1d124af1034..d3fb5e0459d 100644
--- a/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
+++ b/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
@@ -24,6 +24,13 @@
     <includeBaseDirectory>true</includeBaseDirectory>
     
     <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/../../../../../agent/core/target</directory>
+            <outputDirectory>./agent</outputDirectory>
+            <includes>
+                <include>shardingsphere-agent.jar</include>
+            </includes>
+        </fileSet>
         <fileSet>
             <directory>${project.basedir}/../../../../../agent/plugins/tracing/type/target/plugins</directory>
             <outputDirectory>./agent/plugins</outputDirectory>
@@ -32,10 +39,10 @@
             </includes>
         </fileSet>
         <fileSet>
-            <directory>${project.basedir}/../../../../../agent/core/target</directory>
-            <outputDirectory>./agent</outputDirectory>
+            <directory>${project.basedir}/../../../../../agent/plugins/core/target/lib</directory>
+            <outputDirectory>./agent/lib</outputDirectory>
             <includes>
-                <include>shardingsphere-agent.jar</include>
+                <include>**.jar</include>
             </includes>
         </fileSet>
         <fileSet>
diff --git a/test/e2e/agent/plugins/zipkin/Dockerfile b/test/e2e/agent/plugins/zipkin/Dockerfile
index 59af1d45ac2..1fd2a772ece 100644
--- a/test/e2e/agent/plugins/zipkin/Dockerfile
+++ b/test/e2e/agent/plugins/zipkin/Dockerfile
@@ -23,5 +23,5 @@ ENV WAIT_VERSION 2.7.2
 ADD target/${APP_NAME}.tar.gz /opt
 ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
 RUN chmod +x /wait
-RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy-agent-zipkin
-ENTRYPOINT /wait && /opt/shardingsphere-proxy-agent-zipkin/bin/start.sh && tail -f /opt/shardingsphere-proxy-agent-zipkin/logs/stdout.log
+RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy-agent-tracing-zipkin
+ENTRYPOINT /wait && /opt/shardingsphere-proxy-agent-tracing-zipkin/bin/start.sh && tail -f /opt/shardingsphere-proxy-agent-tracing-zipkin/logs/stdout.log
diff --git a/test/e2e/agent/plugins/zipkin/pom.xml b/test/e2e/agent/plugins/zipkin/pom.xml
index 683a53f5f1d..5db7e7d0375 100644
--- a/test/e2e/agent/plugins/zipkin/pom.xml
+++ b/test/e2e/agent/plugins/zipkin/pom.xml
@@ -121,7 +121,7 @@
                         <configuration>
                             <appendAssemblyId>false</appendAssemblyId>
                             <descriptors>
-                                <descriptor>src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml</descriptor>
+                                <descriptor>src/test/assembly/shardingsphere-proxy-agent-tracing-zipkin-assembly.xml</descriptor>
                             </descriptors>
                         </configuration>
                         <executions>
@@ -138,7 +138,7 @@
                         <groupId>com.spotify</groupId>
                         <artifactId>dockerfile-maven-plugin</artifactId>
                         <configuration>
-                            <repository>apache/shardingsphere-proxy-agent-zipkin-test</repository>
+                            <repository>apache/shardingsphere-proxy-agent-tracing-zipkin-test</repository>
                             <tag>${project.version}</tag>
                             <tag>latest</tag>
                             <buildArgs>
@@ -154,6 +154,34 @@
                             </execution>
                         </executions>
                     </plugin>
+                    <plugin>
+                        <groupId>com.dkanejs.maven.plugins</groupId>
+                        <artifactId>docker-compose-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>agent-zipkin-up</id>
+                                <goals>
+                                    <goal>up</goal>
+                                </goals>
+                                <phase>pre-integration-test</phase>
+                                <configuration>
+                                    <composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+                                    <detachedMode>true</detachedMode>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>agent-zipkin-down</id>
+                                <goals>
+                                    <goal>down</goal>
+                                </goals>
+                                <phase>post-integration-test</phase>
+                                <configuration>
+                                    <composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+                                    <removeVolumes>true</removeVolumes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
                 </plugins>
             </build>
         </profile>
diff --git a/test/e2e/agent/plugins/zipkin/src/test/assembly/bin/start.sh b/test/e2e/agent/plugins/zipkin/src/test/assembly/bin/start.sh
index a7feab4a954..2d593770f63 100644
--- a/test/e2e/agent/plugins/zipkin/src/test/assembly/bin/start.sh
+++ b/test/e2e/agent/plugins/zipkin/src/test/assembly/bin/start.sh
@@ -70,6 +70,6 @@ fi
 
 echo "The classpath is ${CLASS_PATH}"
 
-nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS} -javaagent:/opt/shardingsphere-proxy-agent-zipkin/agent/shardingsphere-agent.jar  -classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
+nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS} -javaagent:/opt/shardingsphere-proxy-agent-tracing-zipkin/agent/shardingsphere-agent.jar  -classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
 sleep 1
 echo "Please check the STDOUT file: $STDOUT_FILE"
diff --git a/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml b/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-tracing-zipkin-assembly.xml
similarity index 78%
rename from test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml
rename to test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-tracing-zipkin-assembly.xml
index ae7a89a6df6..6151aa905c8 100644
--- a/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml
+++ b/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-tracing-zipkin-assembly.xml
@@ -25,17 +25,31 @@
     
     <fileSets>
         <fileSet>
-            <directory>${project.basedir}/../../../../../agent/plugins/tracing/target/plugins</directory>
+            <directory>${project.basedir}/../../../../../agent/core/target</directory>
+            <outputDirectory>./agent</outputDirectory>
+            <includes>
+                <include>shardingsphere-agent.jar</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/../../../../../agent/plugins/tracing/type/target/plugins</directory>
             <outputDirectory>./agent/plugins</outputDirectory>
             <includes>
                 <include>shardingsphere-agent-tracing-zipkin-${project.version}.jar</include>
             </includes>
         </fileSet>
         <fileSet>
-            <directory>${project.basedir}/../../../../../agent/core/target</directory>
-            <outputDirectory>./agent</outputDirectory>
+            <directory>${project.basedir}/../../../../../agent/plugins/core/target/lib</directory>
+            <outputDirectory>./agent/lib</outputDirectory>
             <includes>
-                <include>shardingsphere-agent.jar</include>
+                <include>**.jar</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/../../../../../agent/plugins/logging/type/target/plugins</directory>
+            <outputDirectory>./agent/lib</outputDirectory>
+            <includes>
+                <include>**.jar</include>
             </includes>
         </fileSet>
         <fileSet>
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/agent/conf/agent.yaml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/agent/conf/agent.yaml
index c3cde96264d..282bb360aed 100644
--- a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/agent/conf/agent.yaml
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/agent/conf/agent.yaml
@@ -37,7 +37,7 @@ plugins:
 #        jaeger-reporter-log-spans: "true"
 #        jaeger-reporter-flush-interval: "1"
     Zipkin:
-      host: "localhost"
+      host: "zipkin.agent.tracing.zipkin.host"
       port: 9411
       props:
         service-name: "shardingsphere"
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml
index 38d1918412e..fbd199c7f73 100644
--- a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml
@@ -37,12 +37,11 @@ services:
       - "19411:9411"
 
   shardingsphere-proxy-agent-tracing:
-    image: apache/shardingsphere-proxy-agent-zipkin-test
-    container_name: shardingsphere-proxy-agent-zipkin-test
+    image: apache/shardingsphere-proxy-agent-tracing-zipkin-test
+    container_name: shardingsphere-proxy-agent-tracing-zipkin-test
     ports:
       - "43071:3307"
       - "43081:3308"
-      - "19411:9411"
     links:
       - "mysql:mysql.agent.tracing.zipkin.host"
       - "zipkin:zipkin.agent.tracing.zipkin.host"