This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 7c5dc24e279 add tracing e2e test for JDBC that use agent (#24777)
7c5dc24e279 is described below
commit 7c5dc24e279483a48edf0dd6edab3cad36b594cb
Author: jiangML <[email protected]>
AuthorDate: Thu Mar 23 18:28:11 2023 +0800
add tracing e2e test for JDBC that use agent (#24777)
* refactor jaeger e2e test of proxy
* add jaeger e2e test for JDBC
* refactor zipkin e2e test of proxy
* add zipkin e2e test for JDBC
* add jaeger, zipkin e2e test job for JDBC
* rename assertProxyWithAgent name to assertWithAgent
---
.github/workflows/e2e-agent.yml | 6 +
.../project/service/impl/OrderServiceImpl.java | 9 +-
.../e2e/agent/common/env/E2ETestEnvironment.java | 6 +-
.../test/e2e/agent/metrics/MetricsPluginE2EIT.java | 5 +-
test/e2e/agent/plugins/tracing/jaeger/pom.xml | 130 ++++++++++++++++++++-
.../test/e2e/agent/jaeger/JaegerPluginE2EIT.java | 4 +-
.../jaeger/cases/IntegrationTestCasesLoader.java | 5 +-
.../src/test/resources/cases/jdbc}/execute_sql.xml | 2 +-
.../src/test/resources/cases/jdbc}/parse_sql.xml | 7 +-
.../resources/cases/{ => jdbc}/root_invoke.xml | 0
.../resources/cases/{ => proxy}/execute_sql.xml | 2 +-
.../test/resources/cases/{ => proxy}/parse_sql.xml | 0
.../test/resources/cases/proxy}/root_invoke.xml | 0
.../test/resources/docker/agent/conf/agent.yaml | 2 +-
.../test/resources/docker/jdbc}/Dockerfile | 13 +--
.../conf/agent.yaml => jdbc/conf/application.yml} | 15 ++-
.../conf/config-db.yaml => jdbc/conf/config.yaml} | 18 +--
.../src/test/resources/docker/jdbc/conf/start.sh | 54 +++++++++
.../resources/docker/{ => jdbc}/docker-compose.yml | 23 ++--
.../test/resources/docker/proxy}/Dockerfile | 4 +-
.../resources/docker/proxy/conf/config-db.yaml | 4 +-
.../docker/{ => proxy}/docker-compose.yml | 14 +--
.../src/test/resources/env/engine-env.properties | 8 ++
test/e2e/agent/plugins/tracing/zipkin/pom.xml | 130 ++++++++++++++++++++-
.../test/e2e/agent/zipkin/ZipkinPluginE2EIT.java | 4 +-
.../zipkin/cases/IntegrationTestCasesLoader.java | 6 +-
.../resources/cases/{ => jdbc}/execute_sql.xml | 2 +-
.../test/resources/cases/{ => jdbc}/parse_sql.xml | 7 +-
.../src/test/resources/cases/jdbc}/root_invoke.xml | 0
.../resources/cases/{ => proxy}/execute_sql.xml | 2 +-
.../test/resources/cases/{ => proxy}/parse_sql.xml | 0
.../test/resources/cases/proxy}/root_invoke.xml | 0
.../test/resources/docker/agent/conf/agent.yaml | 2 +-
.../src/test/resources/docker/jdbc}/Dockerfile | 13 +--
.../resources/docker/jdbc/conf/application.yml} | 15 ++-
.../conf/config-db.yaml => jdbc/conf/config.yaml} | 18 +--
.../src/test/resources/docker/jdbc/conf/start.sh | 54 +++++++++
.../resources/docker/{ => jdbc}/docker-compose.yml | 23 ++--
.../test/resources/docker/proxy}/Dockerfile | 4 +-
.../resources/docker/proxy/conf/config-db.yaml | 4 +-
.../docker/{ => proxy}/docker-compose.yml | 14 +--
.../src/test/resources/env/engine-env.properties | 8 ++
42 files changed, 501 insertions(+), 136 deletions(-)
diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml
index eef95775029..d56eed8242b 100644
--- a/.github/workflows/e2e-agent.yml
+++ b/.github/workflows/e2e-agent.yml
@@ -81,6 +81,12 @@ jobs:
- adapter: jdbc
feature: metrics
plugin: prometheus
+ - adapter: jdbc
+ feature: tracing
+ plugin: jaeger
+ - adapter: jdbc
+ feature: tracing
+ plugin: zipkin
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
diff --git
a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
index a9a44114ad7..8e0fbd23d9a 100644
---
a/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
+++
b/test/e2e/agent/jdbc-project/src/main/java/org/apache/shardingsphere/test/e2e/agent/jdbc/project/service/impl/OrderServiceImpl.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.impl;
+import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.test.e2e.agent.jdbc.project.entity.OrderEntity;
import
org.apache.shardingsphere.test.e2e.agent.jdbc.project.enums.StatementType;
import
org.apache.shardingsphere.test.e2e.agent.jdbc.project.service.OrderService;
@@ -36,6 +37,7 @@ import java.util.LinkedList;
/**
* Order service impl.
*/
+@Slf4j
@Service
public class OrderServiceImpl implements OrderService {
@@ -87,7 +89,7 @@ public class OrderServiceImpl implements OrderService {
} catch (final SQLException ignored) {
}
} else if (StatementType.PREPARED == statementType) {
- String sql = String.format("DELETE FROM t_order WHERE
order_id=%d", orderId);
+ String sql = String.format("DELETE FROM t_order WHERE order_id =
%d", orderId);
execute(sql, true, false);
}
}
@@ -95,7 +97,7 @@ public class OrderServiceImpl implements OrderService {
@Override
public void update(final OrderEntity order, final StatementType
statementType) {
if (StatementType.STATEMENT == statementType) {
- String sql = "UPDATE t_order SET status = ? WHERE order_id =?";
+ String sql = "UPDATE t_order SET status = ? WHERE order_id = ?";
try (Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(sql,
Statement.RETURN_GENERATED_KEYS)) {
connection.setAutoCommit(false);
preparedStatement.setString(1, order.getStatus());
@@ -105,7 +107,7 @@ public class OrderServiceImpl implements OrderService {
} catch (final SQLException ignored) {
}
} else if (StatementType.PREPARED == statementType) {
- String sql = String.format("UPDATE t_order SET status = '%s' WHERE
order_id=%d", order.getStatus(), order.getOrderId());
+ String sql = String.format("UPDATE t_order SET status = '%s' WHERE
order_id = %d", order.getStatus(), order.getOrderId());
execute(sql, false, false);
}
}
@@ -137,6 +139,7 @@ public class OrderServiceImpl implements OrderService {
}
private void execute(final String sql, final boolean autoCommit, final
boolean isRollback) {
+ log.info("execute sql:{}", sql);
try (Connection connection = dataSource.getConnection(); Statement
statement = connection.createStatement()) {
if (autoCommit) {
statement.execute(sql);
diff --git
a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java
b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java
index c744d348739..327d06ed935 100644
---
a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java
+++
b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/E2ETestEnvironment.java
@@ -52,12 +52,15 @@ public final class E2ETestEnvironment {
private boolean isAdaptedProxy;
+ private String adapter;
+
private final AtomicBoolean prepareFlag = new AtomicBoolean();
private E2ETestEnvironment() {
props =
EnvironmentProperties.loadProperties("env/engine-env.properties");
isEnvironmentPrepared =
props.getProperty("it.env.value").equals(props.getProperty("it.env.type"));
- isAdaptedProxy =
"proxy".equalsIgnoreCase(props.getProperty("it.env.adapter", "proxy"));
+ adapter = props.getProperty("it.env.adapter", "proxy");
+ isAdaptedProxy = "proxy".equalsIgnoreCase(adapter);
}
/**
@@ -148,6 +151,7 @@ public final class E2ETestEnvironment {
String selectAllUrl = props.getProperty("jdbc.path.select.all");
try {
Response response =
OkHttpUtils.getInstance().getResponse(String.join("", baseUrl, selectAllUrl));
+ response.close();
return response.isSuccessful();
} catch (final IOException ignored) {
}
diff --git
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
index 61b8e1b8fe0..2ebe6f9c082 100644
---
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
+++
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
@@ -46,7 +46,7 @@ public final class MetricsPluginE2EIT {
@ParameterizedTest
@ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertProxyWithAgent(final MetricTestCase metricTestCase) {
+ public void assertWithAgent(final MetricTestCase metricTestCase) {
Properties props = E2ETestEnvironment.getInstance().getProps();
String metaDataURL = props.getProperty("prometheus.metadata.url");
String queryURL = props.getProperty("prometheus.query.url");
@@ -81,8 +81,7 @@ public final class MetricsPluginE2EIT {
@Override
public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
- String adapter =
E2ETestEnvironment.getInstance().getProps().getProperty("it.env.adapter",
"proxy");
- return
IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases(adapter).stream().map(Arguments::of);
+ return
IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases(E2ETestEnvironment.getInstance().getAdapter()).stream().map(Arguments::of);
}
}
}
diff --git a/test/e2e/agent/plugins/tracing/jaeger/pom.xml
b/test/e2e/agent/plugins/tracing/jaeger/pom.xml
index 85dec7a7f9f..d27d67090c6 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/pom.xml
+++ b/test/e2e/agent/plugins/tracing/jaeger/pom.xml
@@ -30,6 +30,11 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<mysql-connector-java.version>8.0.31</mysql-connector-java.version>
+
+
<docker.proxy.context.directory>target/proxy</docker.proxy.context.directory>
+
<docker.proxy.compose.file>${project.basedir}/src/test/resources/docker/proxy/docker-compose.yml</docker.proxy.compose.file>
+
<docker.jdbc.context.directory>target/jdbc</docker.jdbc.context.directory>
+
<docker.jdbc.compose.file>${project.basedir}/src/test/resources/docker/jdbc/docker-compose.yml</docker.jdbc.compose.file>
</properties>
<dependencies>
@@ -87,10 +92,19 @@
</goals>
<phase>validate</phase>
<configuration>
- <outputDirectory>target</outputDirectory>
+
<outputDirectory>${docker.proxy.context.directory}</outputDirectory>
<resources>
+ <resource>
+
<directory>${project.basedir}/src/test/resources/docker/proxy/</directory>
+ <includes>
+ <include>Dockerfile</include>
+ </includes>
+ </resource>
<resource>
<directory>${project.basedir}/../../../../../../distribution/proxy/target/</directory>
+ <includes>
+
<include>${docker.proxy.distribution.name}.tar.gz</include>
+ </includes>
</resource>
</resources>
</configuration>
@@ -107,6 +121,8 @@
<buildArgs>
<APP_NAME>${docker.proxy.distribution.name}</APP_NAME>
</buildArgs>
+
<contextDirectory>${docker.proxy.context.directory}</contextDirectory>
+
<dockerfile>${docker.proxy.context.directory}/Dockerfile</dockerfile>
</configuration>
<executions>
<execution>
@@ -128,7 +144,115 @@
</goals>
<phase>pre-integration-test</phase>
<configuration>
-
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+
<composeFile>${docker.proxy.compose.file}</composeFile>
+ <detachedMode>true</detachedMode>
+ </configuration>
+ </execution>
+ <execution>
+ <id>agent-jaeger-down</id>
+ <goals>
+ <goal>down</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ <configuration>
+
<composeFile>${docker.proxy.compose.file}</composeFile>
+ <removeVolumes>true</removeVolumes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>it.env.jdbc.jaeger</id>
+ <properties>
+ <it.env>jaeger</it.env>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+
<outputDirectory>${docker.jdbc.context.directory}</outputDirectory>
+ <resources>
+ <resource>
+
<directory>${project.basedir}/src/test/resources/docker/jdbc/</directory>
+ <includes>
+ <include>Dockerfile</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+
<outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app</outputDirectory>
+ <resources>
+ <resource>
+
<directory>${project.basedir}/../../../jdbc-project/target/</directory>
+ <includes>
+
<include>${docker.jdbc.distribution.name}.jar</include>
+ </includes>
+ </resource>
+ <resource>
+
<directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ </resource>
+ <resource>
+
<directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>dockerfile-maven-plugin</artifactId>
+ <configuration>
+
<repository>apache/shardingsphere-jdbc-agent-tracing-jaeger-test</repository>
+ <tag>${project.version}</tag>
+ <tag>latest</tag>
+ <buildArgs>
+
<APP_NAME>${docker.jdbc.distribution.name}</APP_NAME>
+ </buildArgs>
+
<contextDirectory>${docker.jdbc.context.directory}</contextDirectory>
+
<dockerfile>${docker.jdbc.context.directory}/Dockerfile</dockerfile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>shardingsphere-jdbc-bin</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.dkanejs.maven.plugins</groupId>
+ <artifactId>docker-compose-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>agent-jaeger-up</id>
+ <goals>
+ <goal>up</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+
<composeFile>${docker.jdbc.compose.file}</composeFile>
<detachedMode>true</detachedMode>
</configuration>
</execution>
@@ -139,7 +263,7 @@
</goals>
<phase>post-integration-test</phase>
<configuration>
-
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+
<composeFile>${docker.jdbc.compose.file}</composeFile>
<removeVolumes>true</removeVolumes>
</configuration>
</execution>
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
index 4c164938607..210e660a12e 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
@@ -36,7 +36,7 @@ public final class JaegerPluginE2EIT {
@ParameterizedTest
@ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertProxyWithAgent(final SpanTestCase spanTestCase) {
+ public void assertWithAgent(final SpanTestCase spanTestCase) {
SpanAssert.assertIs(E2ETestEnvironment.getInstance().getProps().getProperty("jaeger.url"),
spanTestCase);
}
@@ -44,7 +44,7 @@ public final class JaegerPluginE2EIT {
@Override
public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
- return
IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases().stream().map(Arguments::of);
+ return
IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases(E2ETestEnvironment.getInstance().getAdapter()).stream().map(Arguments::of);
}
}
}
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/IntegrationTestCasesLoader.java
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/IntegrationTestCasesLoader.java
index c76e14544e4..aa45a77cf7e 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/IntegrationTestCasesLoader.java
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/IntegrationTestCasesLoader.java
@@ -62,15 +62,16 @@ public final class IntegrationTestCasesLoader {
/**
* Load integration test cases.
*
+ * @param adapter adapter
* @return integration test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- public Collection<SpanTestCase> loadIntegrationTestCases() {
+ public Collection<SpanTestCase> loadIntegrationTestCases(final String
adapter) {
if (null != integrationTestCases) {
return integrationTestCases;
}
integrationTestCases = new LinkedList<>();
- URL url =
Objects.requireNonNull(IntegrationTestCasesLoader.class.getClassLoader().getResource("cases/"));
+ URL url =
Objects.requireNonNull(IntegrationTestCasesLoader.class.getClassLoader().getResource(String.format("cases/%s",
adapter)));
Collection<File> files = getFiles(url);
for (File each : files) {
integrationTestCases.addAll(unmarshal(each.getPath()).getTestCases());
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
similarity index 93%
copy from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
index 3210f252d9e..84bec547bbb 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
@@ -21,7 +21,7 @@
<tag-assertion key="component" value="ShardingSphere"
need-assert-value="true" />
<tag-assertion key="span.kind" value="client" need-assert-value="true"
/>
<tag-assertion key="db.type" value="MySQL" need-assert-value="true" />
- <tag-assertion key="peer.hostname"
value="mysql.agent.tracing.zipkin.host" need-assert-value="true" />
+ <tag-assertion key="peer.hostname"
value="mysql.agent.jdbc.jaeger.host" need-assert-value="true" />
<tag-assertion key="peer.port" value="3306" need-assert-value="true" />
<tag-assertion key="db.instance" value="ds_0" need-assert-value="true"
/>
<tag-assertion key="db.instance" value="ds_1" need-assert-value="true"
/>
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
similarity index 82%
copy from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
index 4a2c952fc4b..230f9da19f4 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
@@ -21,10 +21,9 @@
<tag-assertion key="component" value="ShardingSphere"
need-assert-value="true" />
<tag-assertion key="span.kind" value="internal"
need-assert-value="true" />
<tag-assertion key="db.statement" />
- <tag-assertion key="db.statement" value="SELECT * FROM
non_existent_table" need-assert-value="true" />
<tag-assertion key="db.statement" value="SELECT * FROM t_order"
need-assert-value="true" />
- <tag-assertion key="db.statement" value="INSERT INTO t_order
(order_id, user_id, status) VALUES (10, 10, 'INSERT_TEST')"
need-assert-value="true" />
- <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE
order_id=10" need-assert-value="true" />
- <tag-assertion key="db.statement" value="UPDATE t_order SET status =
'ROLL_BACK' WHERE order_id =1000" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="INSERT INTO t_order
(order_id, user_id, status) VALUES (1, 1, 'OK')" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="UPDATE t_order SET status =
'Fail' WHERE order_id = 1" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE
order_id = 1" need-assert-value="true" />
</test-case>
</integration-test-cases>
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/root_invoke.xml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/root_invoke.xml
similarity index 100%
copy from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/root_invoke.xml
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/root_invoke.xml
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/execute_sql.xml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
similarity index 93%
rename from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/execute_sql.xml
rename to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
index 872ca5de4b3..8f000a32d78 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/execute_sql.xml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
@@ -21,7 +21,7 @@
<tag-assertion key="component" value="ShardingSphere"
need-assert-value="true" />
<tag-assertion key="span.kind" value="client" need-assert-value="true"
/>
<tag-assertion key="db.type" value="MySQL" need-assert-value="true" />
- <tag-assertion key="peer.hostname"
value="mysql.agent.tracing.jaeger.host" need-assert-value="true" />
+ <tag-assertion key="peer.hostname"
value="mysql.agent.proxy.jaeger.host" need-assert-value="true" />
<tag-assertion key="peer.port" value="3306" need-assert-value="true" />
<tag-assertion key="db.instance" value="ds_0" need-assert-value="true"
/>
<tag-assertion key="db.instance" value="ds_1" need-assert-value="true"
/>
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/parse_sql.xml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/parse_sql.xml
similarity index 100%
rename from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/parse_sql.xml
rename to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/parse_sql.xml
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/root_invoke.xml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/root_invoke.xml
similarity index 100%
rename from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/root_invoke.xml
rename to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/root_invoke.xml
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
index df6829b6b09..a1c1387d582 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
@@ -21,5 +21,5 @@ plugins:
props:
otel.service.name: "shardingsphere"
otel.traces.exporter: "otlp"
- otel.exporter.otlp.traces.endpoint:
"http://jaeger.agent.tracing.jaeger.host:4317"
+ otel.exporter.otlp.traces.endpoint: "http://jaeger.agent.host:4317"
otel.traces.sampler: "always_on"
diff --git a/test/e2e/agent/plugins/tracing/jaeger/Dockerfile
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile
similarity index 68%
copy from test/e2e/agent/plugins/tracing/jaeger/Dockerfile
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile
index 8019795ff49..e734fd67a0d 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/Dockerfile
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/Dockerfile
@@ -15,14 +15,13 @@
# limitations under the License.
#
-FROM eclipse-temurin:8-jdk
+FROM eclipse-temurin:11-jdk
ARG APP_NAME
-ENV WAIT_VERSION 2.7.2
+ENV WAIT_VERSION=2.7.2 JAR_FILE_NAME=${APP_NAME}.jar
-ADD target/${APP_NAME}.tar.gz /opt
+COPY shardingsphere-jdbc-app /opt/shardingsphere-jdbc-app
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
-RUN wget
https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar
-P /opt/shardingsphere-proxy/lib
-ENTRYPOINT /wait && /opt/shardingsphere-proxy/bin/start.sh -g && tail -f
/opt/shardingsphere-proxy/logs/stdout.log
+RUN chmod +x /wait && chmod +x /opt/shardingsphere-jdbc-app/start.sh
+WORKDIR /opt/shardingsphere-jdbc-app
+ENTRYPOINT /wait && ./start.sh $JAR_FILE_NAME --agent && tail -f
./logs/stdout.log
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/application.yml
similarity index 74%
copy from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/application.yml
index df6829b6b09..389a37be2ac 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/application.yml
@@ -15,11 +15,10 @@
# limitations under the License.
#
-plugins:
- tracing:
- OpenTelemetry:
- props:
- otel.service.name: "shardingsphere"
- otel.traces.exporter: "otlp"
- otel.exporter.otlp.traces.endpoint:
"http://jaeger.agent.tracing.jaeger.host:4317"
- otel.traces.sampler: "always_on"
+server:
+ port: 80
+
+spring:
+ datasource:
+ driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
+ url:
jdbc:shardingsphere:absolutepath:/opt/shardingsphere-jdbc-app/config.yaml
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/config.yaml
similarity index 75%
copy from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/config.yaml
index a5a3cce93ed..3f0684bb14c 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/config.yaml
@@ -19,23 +19,17 @@ databaseName: agent-tracing-jaeger-db
dataSources:
ds_0:
- url:
jdbc:mysql://mysql.agent.tracing.jaeger.host:3306/agent_jaeger_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl:
jdbc:mysql://mysql.agent.jdbc.jaeger.host:3306/agent_jaeger_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
- connectionTimeoutMilliseconds: 30000
- idleTimeoutMilliseconds: 60000
- maxLifetimeMilliseconds: 1800000
- maxPoolSize: 10
- minPoolSize: 2
ds_1:
- url:
jdbc:mysql://mysql.agent.tracing.jaeger.host:3306/agent_jaeger_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl:
jdbc:mysql://mysql.agent.jdbc.jaeger.host:3306/agent_jaeger_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
- connectionTimeoutMilliseconds: 30000
- idleTimeoutMilliseconds: 60000
- maxLifetimeMilliseconds: 1800000
- maxPoolSize: 10
- minPoolSize: 2
rules:
- !SHARDING
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/start.sh
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/start.sh
new file mode 100644
index 00000000000..46bdf181936
--- /dev/null
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/conf/start.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# 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.
+#
+
+DEPLOY_DIR="$(pwd)"
+LOGS_DIR=${DEPLOY_DIR}/logs
+if [ ! -d "${LOGS_DIR}" ]; then
+ mkdir "${LOGS_DIR}"
+fi
+STDOUT_FILE=${LOGS_DIR}/stdout.log
+JAR_FILE=$1
+
+AGENT_FILE=${DEPLOY_DIR}/agent/shardingsphere-agent.jar
+function set_agent_name() {
+ if [ -d "${DEPLOY_DIR}/agent" ]; then
+ AGENT_NAME=$(ls "${DEPLOY_DIR}/agent/shardingsphere-agent"*)
+ if [ -n "${AGENT_NAME}" ]; then
+ AGENT_FILE=${AGENT_NAME}
+ fi
+ fi
+}
+
+AGENT_PARAM="";
+function set_agent_parameter() {
+ if [ -f "$AGENT_FILE" ]; then
+ AGENT_PARAM=" -javaagent:${AGENT_FILE} "
+ fi
+}
+
+for arg in $*
+do
+ if [ "$arg" == "--agent" ] ; then
+ set_agent_name
+ set_agent_parameter
+ break
+ fi
+ let PARAMETER_INDEX+=1
+done
+
+nohup java ${AGENT_PARAM} -jar ${DEPLOY_DIR}/${JAR_FILE} >> ${STDOUT_FILE}
2>&1 &
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/docker-compose.yml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml
similarity index 71%
copy from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/docker-compose.yml
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml
index ca517290e7e..6f0158f8a75 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/docker-compose.yml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/jdbc/docker-compose.yml
@@ -20,10 +20,10 @@ version: "2.1"
services:
mysql:
image: "mysql/mysql-server:5.7"
- container_name: agent-tracing-jaeger-mysql
+ container_name: agent-jdbc-jaeger-mysql
command: ['--sql_mode=',
'--default-authentication-plugin=mysql_native_password']
volumes:
- - ../env/mysql:/docker-entrypoint-initdb.d/
+ - ../../env/mysql:/docker-entrypoint-initdb.d/
ports:
- "43061:3306"
environment:
@@ -31,25 +31,24 @@ services:
jaeger:
image: "jaegertracing/all-in-one:1.41"
- container_name: agent-tracing-jaeger
+ container_name: agent-jdbc-jaeger
ports:
- "14317:4317"
- "26686:16686"
environment:
- COLLECTOR_OTLP_ENABLED=true
- shardingsphere-proxy-agent-tracing:
- image: apache/shardingsphere-proxy-agent-tracing-jaeger-test
- container_name: shardingsphere-proxy-agent-tracing-jaeger-test
+ shardingsphere-jdbc-agent-tracing:
+ image: apache/shardingsphere-jdbc-agent-tracing-jaeger-test
+ container_name: shardingsphere-jdbc-agent-tracing-jaeger-test
ports:
- - "43071:3307"
- - "43081:3308"
+ - "18080:80"
links:
- - "mysql:mysql.agent.tracing.jaeger.host"
- - "jaeger:jaeger.agent.tracing.jaeger.host"
+ - "mysql:mysql.agent.jdbc.jaeger.host"
+ - "jaeger:jaeger.agent.host"
volumes:
- - ./proxy/conf:/opt/shardingsphere-proxy/conf
- - ./agent/conf:/opt/shardingsphere-proxy/agent/conf
+ - ../agent/conf:/opt/shardingsphere-jdbc-app/agent/conf
+ - ../../../../../target/jdbc/logs:/opt/shardingsphere-jdbc-app/logs
depends_on:
- mysql
- jaeger
diff --git a/test/e2e/agent/plugins/tracing/jaeger/Dockerfile
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/Dockerfile
similarity index 95%
copy from test/e2e/agent/plugins/tracing/jaeger/Dockerfile
copy to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/Dockerfile
index 8019795ff49..6ccdd7420bb 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/Dockerfile
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/Dockerfile
@@ -15,12 +15,12 @@
# limitations under the License.
#
-FROM eclipse-temurin:8-jdk
+FROM eclipse-temurin:11-jdk
ARG APP_NAME
ENV WAIT_VERSION 2.7.2
-ADD target/${APP_NAME}.tar.gz /opt
+ADD ${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
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
index a5a3cce93ed..98c552875db 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/conf/config-db.yaml
@@ -19,7 +19,7 @@ databaseName: agent-tracing-jaeger-db
dataSources:
ds_0:
- url:
jdbc:mysql://mysql.agent.tracing.jaeger.host:3306/agent_jaeger_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ url:
jdbc:mysql://mysql.agent.proxy.jaeger.host:3306/agent_jaeger_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -28,7 +28,7 @@ dataSources:
maxPoolSize: 10
minPoolSize: 2
ds_1:
- url:
jdbc:mysql://mysql.agent.tracing.jaeger.host:3306/agent_jaeger_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ url:
jdbc:mysql://mysql.agent.proxy.jaeger.host:3306/agent_jaeger_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/docker-compose.yml
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/docker-compose.yml
similarity index 82%
rename from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/docker-compose.yml
rename to
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/docker-compose.yml
index ca517290e7e..54602e99b1d 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/docker-compose.yml
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/proxy/docker-compose.yml
@@ -20,10 +20,10 @@ version: "2.1"
services:
mysql:
image: "mysql/mysql-server:5.7"
- container_name: agent-tracing-jaeger-mysql
+ container_name: agent-proxy-jaeger-mysql
command: ['--sql_mode=',
'--default-authentication-plugin=mysql_native_password']
volumes:
- - ../env/mysql:/docker-entrypoint-initdb.d/
+ - ../../env/mysql:/docker-entrypoint-initdb.d/
ports:
- "43061:3306"
environment:
@@ -31,7 +31,7 @@ services:
jaeger:
image: "jaegertracing/all-in-one:1.41"
- container_name: agent-tracing-jaeger
+ container_name: agent-proxy-jaeger
ports:
- "14317:4317"
- "26686:16686"
@@ -45,11 +45,11 @@ services:
- "43071:3307"
- "43081:3308"
links:
- - "mysql:mysql.agent.tracing.jaeger.host"
- - "jaeger:jaeger.agent.tracing.jaeger.host"
+ - "mysql:mysql.agent.proxy.jaeger.host"
+ - "jaeger:jaeger.agent.host"
volumes:
- - ./proxy/conf:/opt/shardingsphere-proxy/conf
- - ./agent/conf:/opt/shardingsphere-proxy/agent/conf
+ - ./conf:/opt/shardingsphere-proxy/conf
+ - ../agent/conf:/opt/shardingsphere-proxy/agent/conf
depends_on:
- mysql
- jaeger
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
index bc08b8cd95d..22d01fc3aaa 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/env/engine-env.properties
@@ -22,5 +22,13 @@
proxy.url=jdbc:mysql://127.0.0.1:43071/agent-tracing-jaeger-db?serverTimezone=UT
proxy.username=root
proxy.password=root
+jdbc.base.url=http://127.0.0.1:18080
+jdbc.path.create.table=/order/createTable
+jdbc.path.drop.table=/order/dropTable
+jdbc.path.insert=/order/insert
+jdbc.path.update=/order/update
+jdbc.path.select.all=/order/selectAll
+jdbc.path.delete=/order/delete
+
jaeger.url=http://127.0.0.1:26686
collect.data.wait.milliseconds=5000
diff --git a/test/e2e/agent/plugins/tracing/zipkin/pom.xml
b/test/e2e/agent/plugins/tracing/zipkin/pom.xml
index 722e5bb22c8..fa305386c35 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/pom.xml
+++ b/test/e2e/agent/plugins/tracing/zipkin/pom.xml
@@ -30,6 +30,11 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<mysql-connector-java.version>8.0.31</mysql-connector-java.version>
+
+
<docker.proxy.context.directory>target/proxy</docker.proxy.context.directory>
+
<docker.proxy.compose.file>${project.basedir}/src/test/resources/docker/proxy/docker-compose.yml</docker.proxy.compose.file>
+
<docker.jdbc.context.directory>target/jdbc</docker.jdbc.context.directory>
+
<docker.jdbc.compose.file>${project.basedir}/src/test/resources/docker/jdbc/docker-compose.yml</docker.jdbc.compose.file>
</properties>
<dependencies>
@@ -87,10 +92,19 @@
</goals>
<phase>validate</phase>
<configuration>
- <outputDirectory>target</outputDirectory>
+
<outputDirectory>${docker.proxy.context.directory}</outputDirectory>
<resources>
+ <resource>
+
<directory>${project.basedir}/src/test/resources/docker/proxy/</directory>
+ <includes>
+ <include>Dockerfile</include>
+ </includes>
+ </resource>
<resource>
<directory>${project.basedir}/../../../../../../distribution/proxy/target/</directory>
+ <includes>
+
<include>${docker.proxy.distribution.name}.tar.gz</include>
+ </includes>
</resource>
</resources>
</configuration>
@@ -107,6 +121,8 @@
<buildArgs>
<APP_NAME>${docker.proxy.distribution.name}</APP_NAME>
</buildArgs>
+
<contextDirectory>${docker.proxy.context.directory}</contextDirectory>
+
<dockerfile>${docker.proxy.context.directory}/Dockerfile</dockerfile>
</configuration>
<executions>
<execution>
@@ -128,7 +144,115 @@
</goals>
<phase>pre-integration-test</phase>
<configuration>
-
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+
<composeFile>${docker.proxy.compose.file}</composeFile>
+ <detachedMode>true</detachedMode>
+ </configuration>
+ </execution>
+ <execution>
+ <id>agent-zipkin-down</id>
+ <goals>
+ <goal>down</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ <configuration>
+
<composeFile>${docker.proxy.compose.file}</composeFile>
+ <removeVolumes>true</removeVolumes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>it.env.jdbc.zipkin</id>
+ <properties>
+ <it.env>zipkin</it.env>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+
<outputDirectory>${docker.jdbc.context.directory}</outputDirectory>
+ <resources>
+ <resource>
+
<directory>${project.basedir}/src/test/resources/docker/jdbc/</directory>
+ <includes>
+ <include>Dockerfile</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+
<outputDirectory>${docker.jdbc.context.directory}/shardingsphere-jdbc-app</outputDirectory>
+ <resources>
+ <resource>
+
<directory>${project.basedir}/../../../jdbc-project/target/</directory>
+ <includes>
+
<include>${docker.jdbc.distribution.name}.jar</include>
+ </includes>
+ </resource>
+ <resource>
+
<directory>${project.basedir}/src/test/resources/docker/jdbc/conf</directory>
+ </resource>
+ <resource>
+
<directory>${project.basedir}/../../../../../../distribution/agent/target/apache-shardingsphere-${project.version}-shardingsphere-agent-bin/</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>dockerfile-maven-plugin</artifactId>
+ <configuration>
+
<repository>apache/shardingsphere-jdbc-agent-tracing-zipkin-test</repository>
+ <tag>${project.version}</tag>
+ <tag>latest</tag>
+ <buildArgs>
+
<APP_NAME>${docker.jdbc.distribution.name}</APP_NAME>
+ </buildArgs>
+
<contextDirectory>${docker.jdbc.context.directory}</contextDirectory>
+
<dockerfile>${docker.jdbc.context.directory}/Dockerfile</dockerfile>
+ </configuration>
+ <executions>
+ <execution>
+ <id>shardingsphere-jdbc-bin</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </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>${docker.jdbc.compose.file}</composeFile>
<detachedMode>true</detachedMode>
</configuration>
</execution>
@@ -139,7 +263,7 @@
</goals>
<phase>post-integration-test</phase>
<configuration>
-
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
+
<composeFile>${docker.jdbc.compose.file}</composeFile>
<removeVolumes>true</removeVolumes>
</configuration>
</execution>
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
index c62d23de4a4..d3aec28e643 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
@@ -36,7 +36,7 @@ public final class ZipkinPluginE2EIT {
@ParameterizedTest
@ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertProxyWithAgent(final SpanTestCase spanTestCase) {
+ public void assertWithAgent(final SpanTestCase spanTestCase) {
SpanAssert.assertIs(E2ETestEnvironment.getInstance().getProps().getProperty("zipkin.url"),
spanTestCase);
}
@@ -44,7 +44,7 @@ public final class ZipkinPluginE2EIT {
@Override
public Stream<? extends Arguments> provideArguments(final
ExtensionContext extensionContext) {
- return
IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases().stream().map(Arguments::of);
+ return
IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases(E2ETestEnvironment.getInstance().getAdapter()).stream().map(Arguments::of);
}
}
}
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCasesLoader.java
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCasesLoader.java
index d389e7aac10..35668ffde9a 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCasesLoader.java
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCasesLoader.java
@@ -61,16 +61,16 @@ public final class IntegrationTestCasesLoader {
/**
* Load integration test cases.
- *
+ * @param adapter adapter
* @return integration test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- public Collection<SpanTestCase> loadIntegrationTestCases() {
+ public Collection<SpanTestCase> loadIntegrationTestCases(final String
adapter) {
if (null != integrationTestCases) {
return integrationTestCases;
}
integrationTestCases = new LinkedList<>();
- URL url =
Objects.requireNonNull(IntegrationTestCasesLoader.class.getClassLoader().getResource("cases/"));
+ URL url =
Objects.requireNonNull(IntegrationTestCasesLoader.class.getClassLoader().getResource(String.format("cases/%s",
adapter)));
Collection<File> files = getFiles(url);
for (File each : files) {
integrationTestCases.addAll(unmarshal(each.getPath()).getTestCases());
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/execute_sql.xml
similarity index 93%
copy from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
copy to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/execute_sql.xml
index 3210f252d9e..58c9bdf21cf 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/execute_sql.xml
@@ -21,7 +21,7 @@
<tag-assertion key="component" value="ShardingSphere"
need-assert-value="true" />
<tag-assertion key="span.kind" value="client" need-assert-value="true"
/>
<tag-assertion key="db.type" value="MySQL" need-assert-value="true" />
- <tag-assertion key="peer.hostname"
value="mysql.agent.tracing.zipkin.host" need-assert-value="true" />
+ <tag-assertion key="peer.hostname"
value="mysql.agent.jdbc.zipkin.host" need-assert-value="true" />
<tag-assertion key="peer.port" value="3306" need-assert-value="true" />
<tag-assertion key="db.instance" value="ds_0" need-assert-value="true"
/>
<tag-assertion key="db.instance" value="ds_1" need-assert-value="true"
/>
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml
similarity index 82%
copy from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
copy to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml
index 4a2c952fc4b..230f9da19f4 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/parse_sql.xml
@@ -21,10 +21,9 @@
<tag-assertion key="component" value="ShardingSphere"
need-assert-value="true" />
<tag-assertion key="span.kind" value="internal"
need-assert-value="true" />
<tag-assertion key="db.statement" />
- <tag-assertion key="db.statement" value="SELECT * FROM
non_existent_table" need-assert-value="true" />
<tag-assertion key="db.statement" value="SELECT * FROM t_order"
need-assert-value="true" />
- <tag-assertion key="db.statement" value="INSERT INTO t_order
(order_id, user_id, status) VALUES (10, 10, 'INSERT_TEST')"
need-assert-value="true" />
- <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE
order_id=10" need-assert-value="true" />
- <tag-assertion key="db.statement" value="UPDATE t_order SET status =
'ROLL_BACK' WHERE order_id =1000" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="INSERT INTO t_order
(order_id, user_id, status) VALUES (1, 1, 'OK')" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="UPDATE t_order SET status =
'Fail' WHERE order_id = 1" need-assert-value="true" />
+ <tag-assertion key="db.statement" value="DELETE FROM t_order WHERE
order_id = 1" need-assert-value="true" />
</test-case>
</integration-test-cases>
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/root_invoke.xml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/root_invoke.xml
similarity index 100%
copy from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/root_invoke.xml
copy to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/jdbc/root_invoke.xml
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/execute_sql.xml
similarity index 93%
rename from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
rename to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/execute_sql.xml
index 3210f252d9e..f6b964bdca7 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/execute_sql.xml
@@ -21,7 +21,7 @@
<tag-assertion key="component" value="ShardingSphere"
need-assert-value="true" />
<tag-assertion key="span.kind" value="client" need-assert-value="true"
/>
<tag-assertion key="db.type" value="MySQL" need-assert-value="true" />
- <tag-assertion key="peer.hostname"
value="mysql.agent.tracing.zipkin.host" need-assert-value="true" />
+ <tag-assertion key="peer.hostname"
value="mysql.agent.proxy.zipkin.host" need-assert-value="true" />
<tag-assertion key="peer.port" value="3306" need-assert-value="true" />
<tag-assertion key="db.instance" value="ds_0" need-assert-value="true"
/>
<tag-assertion key="db.instance" value="ds_1" need-assert-value="true"
/>
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/parse_sql.xml
similarity index 100%
rename from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
rename to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/parse_sql.xml
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/root_invoke.xml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/root_invoke.xml
similarity index 100%
rename from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/root_invoke.xml
rename to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/proxy/root_invoke.xml
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/agent.yaml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/agent.yaml
index d3fa9ebe2ae..a25143e18b5 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/agent.yaml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/agent/conf/agent.yaml
@@ -21,5 +21,5 @@ plugins:
props:
otel.service.name: "shardingsphere"
otel.traces.exporter: "zipkin"
- otel.exporter.zipkin.endpoint:
"http://zipkin.agent.tracing.zipkin.host:9411/api/v2/spans"
+ otel.exporter.zipkin.endpoint: "http://zipkin.host:9411/api/v2/spans"
otel.traces.sampler: "always_on"
diff --git a/test/e2e/agent/plugins/tracing/jaeger/Dockerfile
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile
similarity index 68%
rename from test/e2e/agent/plugins/tracing/jaeger/Dockerfile
rename to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile
index 8019795ff49..e734fd67a0d 100644
--- a/test/e2e/agent/plugins/tracing/jaeger/Dockerfile
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/Dockerfile
@@ -15,14 +15,13 @@
# limitations under the License.
#
-FROM eclipse-temurin:8-jdk
+FROM eclipse-temurin:11-jdk
ARG APP_NAME
-ENV WAIT_VERSION 2.7.2
+ENV WAIT_VERSION=2.7.2 JAR_FILE_NAME=${APP_NAME}.jar
-ADD target/${APP_NAME}.tar.gz /opt
+COPY shardingsphere-jdbc-app /opt/shardingsphere-jdbc-app
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
-RUN wget
https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar
-P /opt/shardingsphere-proxy/lib
-ENTRYPOINT /wait && /opt/shardingsphere-proxy/bin/start.sh -g && tail -f
/opt/shardingsphere-proxy/logs/stdout.log
+RUN chmod +x /wait && chmod +x /opt/shardingsphere-jdbc-app/start.sh
+WORKDIR /opt/shardingsphere-jdbc-app
+ENTRYPOINT /wait && ./start.sh $JAR_FILE_NAME --agent && tail -f
./logs/stdout.log
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/application.yml
similarity index 74%
copy from
test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
copy to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/application.yml
index df6829b6b09..389a37be2ac 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/docker/agent/conf/agent.yaml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/application.yml
@@ -15,11 +15,10 @@
# limitations under the License.
#
-plugins:
- tracing:
- OpenTelemetry:
- props:
- otel.service.name: "shardingsphere"
- otel.traces.exporter: "otlp"
- otel.exporter.otlp.traces.endpoint:
"http://jaeger.agent.tracing.jaeger.host:4317"
- otel.traces.sampler: "always_on"
+server:
+ port: 80
+
+spring:
+ datasource:
+ driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
+ url:
jdbc:shardingsphere:absolutepath:/opt/shardingsphere-jdbc-app/config.yaml
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/config.yaml
similarity index 75%
copy from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
copy to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/config.yaml
index 71cf9e6f6d0..9ca0165c591 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/config.yaml
@@ -19,23 +19,17 @@ databaseName: agent-tracing-zipkin-db
dataSources:
ds_0:
- url:
jdbc:mysql://mysql.agent.tracing.zipkin.host:3306/agent_zipkin_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl:
jdbc:mysql://mysql.agent.jdbc.zipkin.host:3306/agent_zipkin_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
- connectionTimeoutMilliseconds: 30000
- idleTimeoutMilliseconds: 60000
- maxLifetimeMilliseconds: 1800000
- maxPoolSize: 10
- minPoolSize: 2
ds_1:
- url:
jdbc:mysql://mysql.agent.tracing.zipkin.host:3306/agent_zipkin_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl:
jdbc:mysql://mysql.agent.jdbc.zipkin.host:3306/agent_zipkin_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
- connectionTimeoutMilliseconds: 30000
- idleTimeoutMilliseconds: 60000
- maxLifetimeMilliseconds: 1800000
- maxPoolSize: 10
- minPoolSize: 2
rules:
- !SHARDING
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/start.sh
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/start.sh
new file mode 100644
index 00000000000..46bdf181936
--- /dev/null
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/conf/start.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# 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.
+#
+
+DEPLOY_DIR="$(pwd)"
+LOGS_DIR=${DEPLOY_DIR}/logs
+if [ ! -d "${LOGS_DIR}" ]; then
+ mkdir "${LOGS_DIR}"
+fi
+STDOUT_FILE=${LOGS_DIR}/stdout.log
+JAR_FILE=$1
+
+AGENT_FILE=${DEPLOY_DIR}/agent/shardingsphere-agent.jar
+function set_agent_name() {
+ if [ -d "${DEPLOY_DIR}/agent" ]; then
+ AGENT_NAME=$(ls "${DEPLOY_DIR}/agent/shardingsphere-agent"*)
+ if [ -n "${AGENT_NAME}" ]; then
+ AGENT_FILE=${AGENT_NAME}
+ fi
+ fi
+}
+
+AGENT_PARAM="";
+function set_agent_parameter() {
+ if [ -f "$AGENT_FILE" ]; then
+ AGENT_PARAM=" -javaagent:${AGENT_FILE} "
+ fi
+}
+
+for arg in $*
+do
+ if [ "$arg" == "--agent" ] ; then
+ set_agent_name
+ set_agent_parameter
+ break
+ fi
+ let PARAMETER_INDEX+=1
+done
+
+nohup java ${AGENT_PARAM} -jar ${DEPLOY_DIR}/${JAR_FILE} >> ${STDOUT_FILE}
2>&1 &
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/docker-compose.yml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml
similarity index 70%
copy from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/docker-compose.yml
copy to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml
index 080f63d7f6a..560c633617a 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/docker-compose.yml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/jdbc/docker-compose.yml
@@ -20,10 +20,10 @@ version: "2.1"
services:
mysql:
image: "mysql/mysql-server:5.7"
- container_name: agent-tracing-zipkin-mysql
+ container_name: agent-jdbc-zipkin-mysql
command: ['--sql_mode=',
'--default-authentication-plugin=mysql_native_password']
volumes:
- - ../env/mysql:/docker-entrypoint-initdb.d/
+ - ../../env/mysql:/docker-entrypoint-initdb.d/
ports:
- "43061:3306"
environment:
@@ -31,23 +31,22 @@ services:
zipkin:
image: "openzipkin/zipkin:latest"
- container_name: agent-tracing-zipkin
+ container_name: agent-jdbc-zipkin
restart: always
ports:
- "19411:9411"
- shardingsphere-proxy-agent-tracing:
- image: apache/shardingsphere-proxy-agent-tracing-zipkin-test
- container_name: shardingsphere-proxy-agent-tracing-zipkin-test
+ shardingsphere-jdbc-agent-tracing:
+ image: apache/shardingsphere-jdbc-agent-tracing-zipkin-test
+ container_name: shardingsphere-jdbc-agent-tracing-zipkin-test
ports:
- - "43071:3307"
- - "43081:3308"
+ - "18080:80"
links:
- - "mysql:mysql.agent.tracing.zipkin.host"
- - "zipkin:zipkin.agent.tracing.zipkin.host"
+ - "mysql:mysql.agent.jdbc.zipkin.host"
+ - "zipkin:zipkin.host"
volumes:
- - ./proxy/conf:/opt/shardingsphere-proxy/conf
- - ./agent/conf:/opt/shardingsphere-proxy/agent/conf
+ - ../agent/conf:/opt/shardingsphere-jdbc-app/agent/conf
+ - ../../../../../target/jdbc/logs:/opt/shardingsphere-jdbc-app/logs
depends_on:
- mysql
- zipkin
diff --git a/test/e2e/agent/plugins/tracing/zipkin/Dockerfile
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/Dockerfile
similarity index 95%
rename from test/e2e/agent/plugins/tracing/zipkin/Dockerfile
rename to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/Dockerfile
index 8019795ff49..6ccdd7420bb 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/Dockerfile
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/Dockerfile
@@ -15,12 +15,12 @@
# limitations under the License.
#
-FROM eclipse-temurin:8-jdk
+FROM eclipse-temurin:11-jdk
ARG APP_NAME
ENV WAIT_VERSION 2.7.2
-ADD target/${APP_NAME}.tar.gz /opt
+ADD ${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
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
index 71cf9e6f6d0..617f99f315c 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
@@ -19,7 +19,7 @@ databaseName: agent-tracing-zipkin-db
dataSources:
ds_0:
- url:
jdbc:mysql://mysql.agent.tracing.zipkin.host:3306/agent_zipkin_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ url:
jdbc:mysql://mysql.agent.proxy.zipkin.host:3306/agent_zipkin_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -28,7 +28,7 @@ dataSources:
maxPoolSize: 10
minPoolSize: 2
ds_1:
- url:
jdbc:mysql://mysql.agent.tracing.zipkin.host:3306/agent_zipkin_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+ url:
jdbc:mysql://mysql.agent.proxy.zipkin.host:3306/agent_zipkin_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/docker-compose.yml
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/docker-compose.yml
similarity index 82%
rename from
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/docker-compose.yml
rename to
test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/docker-compose.yml
index 080f63d7f6a..3125fc0a352 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/docker-compose.yml
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/docker/proxy/docker-compose.yml
@@ -20,10 +20,10 @@ version: "2.1"
services:
mysql:
image: "mysql/mysql-server:5.7"
- container_name: agent-tracing-zipkin-mysql
+ container_name: agent-proxy-zipkin-mysql
command: ['--sql_mode=',
'--default-authentication-plugin=mysql_native_password']
volumes:
- - ../env/mysql:/docker-entrypoint-initdb.d/
+ - ../../env/mysql:/docker-entrypoint-initdb.d/
ports:
- "43061:3306"
environment:
@@ -31,7 +31,7 @@ services:
zipkin:
image: "openzipkin/zipkin:latest"
- container_name: agent-tracing-zipkin
+ container_name: agent-proxy-zipkin
restart: always
ports:
- "19411:9411"
@@ -43,11 +43,11 @@ services:
- "43071:3307"
- "43081:3308"
links:
- - "mysql:mysql.agent.tracing.zipkin.host"
- - "zipkin:zipkin.agent.tracing.zipkin.host"
+ - "mysql:mysql.agent.proxy.zipkin.host"
+ - "zipkin:zipkin.host"
volumes:
- - ./proxy/conf:/opt/shardingsphere-proxy/conf
- - ./agent/conf:/opt/shardingsphere-proxy/agent/conf
+ - ./conf:/opt/shardingsphere-proxy/conf
+ - ../agent/conf:/opt/shardingsphere-proxy/agent/conf
depends_on:
- mysql
- zipkin
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
index 324579109a8..a6ef22e1a7a 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/env/engine-env.properties
@@ -22,5 +22,13 @@
proxy.url=jdbc:mysql://127.0.0.1:43071/agent-tracing-zipkin-db?serverTimezone=UT
proxy.username=root
proxy.password=root
+jdbc.base.url=http://127.0.0.1:18080
+jdbc.path.create.table=/order/createTable
+jdbc.path.drop.table=/order/dropTable
+jdbc.path.insert=/order/insert
+jdbc.path.update=/order/update
+jdbc.path.select.all=/order/selectAll
+jdbc.path.delete=/order/delete
+
zipkin.url=http://127.0.0.1:19411
collect.data.wait.milliseconds=5000