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/02/22 11:56:41 UTC
[shardingsphere] branch master updated: Optimize zipkin e2e test (#24303)
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 2069c32c9f0 Optimize zipkin e2e test (#24303)
2069c32c9f0 is described below
commit 2069c32c9f072612c629d9c469cfeeff70b2ae57
Author: jiangML <10...@qq.com>
AuthorDate: Wed Feb 22 19:56:27 2023 +0800
Optimize zipkin e2e test (#24303)
* optimize zipkin e2e test
* ignore jaeger and opentelemetry e2e test
---
.github/workflows/e2e-agent.yml | 2 +-
.../test/e2e/agent/jaeger/JaegerPluginE2EIT.java | 2 +
.../opentelemetry/OpenTelemetryPluginE2EIT.java | 2 +
test/e2e/agent/plugins/tracing/zipkin/pom.xml | 22 +----
.../test/e2e/agent/zipkin/ZipkinPluginE2EIT.java | 83 +++++------------
.../test/e2e/agent/zipkin/asserts/SpanAssert.java | 82 +++++++++++++++++
.../agent/zipkin/cases/IntegrationTestCases.java | 36 ++++++++
.../zipkin/cases/IntegrationTestCasesLoader.java | 101 +++++++++++++++++++++
.../test/e2e/agent/zipkin/cases/SpanTestCase.java | 45 +++++++++
.../test/e2e/agent/zipkin/cases/TagAssertion.java | 43 +++++++++
.../e2e/agent/zipkin/result/LocalEndpoint.java | 33 +++++++
.../test/e2e/agent/zipkin/result/SpanResult.java | 45 +++++++++
.../src/test/resources/cases/execute_sql.xml | 36 ++++++++
.../zipkin/src/test/resources/cases/parse_sql.xml | 25 +++++
.../src/test/resources/cases/root_invoke.xml | 24 +++++
.../src/test/resources/env/engine-env.properties | 3 +-
16 files changed, 500 insertions(+), 84 deletions(-)
diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml
index c6838202103..b7142fd0bda 100644
--- a/.github/workflows/e2e-agent.yml
+++ b/.github/workflows/e2e-agent.yml
@@ -87,7 +87,7 @@ jobs:
java-version: 8
- name: Run E2E Test
run: |
- ./mvnw -B clean install -f test/e2e/agent/plugins/tracing/${{ matrix.plugin }}/pom.xml -Dspotless.apply.skip=true -Pit.env.${{ matrix.plugin }}
+ ./mvnw -B clean install -f test/e2e/agent/plugins/tracing/${{ matrix.plugin }}/pom.xml -Dspotless.apply.skip=true -Dit.env.type=${{ matrix.plugin }} -Pit.env.${{ matrix.plugin }}
mysql-proxy-agent-metrics:
name: Agent metrics with MySQL
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 acf6a6aef9c..983ebbf392f 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
@@ -23,6 +23,7 @@ import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import org.apache.shardingsphere.test.e2e.agent.common.util.OkHttpUtils;
import org.apache.shardingsphere.test.e2e.agent.jaeger.result.JaegerTraceResult;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
@@ -45,6 +46,7 @@ public final class JaegerPluginE2EIT extends BasePluginE2EIT {
serviceName = props.getProperty("jaeger.servername");
}
+ @Ignore
@SneakyThrows(IOException.class)
@Test
public void assertProxyWithAgent() {
diff --git a/test/e2e/agent/plugins/tracing/opentelemetry/src/test/java/org/apache/shardingsphere/test/e2e/agent/opentelemetry/OpenTelemetryPluginE2EIT.java b/test/e2e/agent/plugins/tracing/opentelemetry/src/test/java/org/apache/shardingsphere/test/e2e/agent/opentelemetry/OpenTelemetryPluginE2EIT.java
index 4a9732bfd04..1baaebd6e96 100644
--- a/test/e2e/agent/plugins/tracing/opentelemetry/src/test/java/org/apache/shardingsphere/test/e2e/agent/opentelemetry/OpenTelemetryPluginE2EIT.java
+++ b/test/e2e/agent/plugins/tracing/opentelemetry/src/test/java/org/apache/shardingsphere/test/e2e/agent/opentelemetry/OpenTelemetryPluginE2EIT.java
@@ -23,6 +23,7 @@ import org.apache.shardingsphere.test.e2e.agent.common.BasePluginE2EIT;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import org.apache.shardingsphere.test.e2e.agent.common.util.OkHttpUtils;
import org.apache.shardingsphere.test.e2e.agent.opentelemetry.result.TracingResult;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
@@ -44,6 +45,7 @@ public final class OpenTelemetryPluginE2EIT extends BasePluginE2EIT {
private static final String EXECUTE_SQL = "/shardingsphere/executesql/";
+ @Ignore
@Test
public void assertProxyWithAgent() throws IOException {
super.assertProxyWithAgent();
diff --git a/test/e2e/agent/plugins/tracing/zipkin/pom.xml b/test/e2e/agent/plugins/tracing/zipkin/pom.xml
index ba77482ef4b..cc3b6ebf625 100644
--- a/test/e2e/agent/plugins/tracing/zipkin/pom.xml
+++ b/test/e2e/agent/plugins/tracing/zipkin/pom.xml
@@ -29,6 +29,7 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
+ <mysql-connector-java.version>8.0.31</mysql-connector-java.version>
</properties>
<dependencies>
@@ -38,35 +39,16 @@
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-proxy-bootstrap</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
+ <version>${mysql-connector-java.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>compile</scope>
</dependency>
</dependencies>
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 4aebcf49f06..6ad02999d19 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
@@ -17,91 +17,52 @@
package org.apache.shardingsphere.test.e2e.agent.zipkin;
-import com.google.common.collect.Lists;
-import com.google.gson.internal.LinkedTreeMap;
import lombok.SneakyThrows;
import org.apache.shardingsphere.test.e2e.agent.common.BasePluginE2EIT;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
-import org.apache.shardingsphere.test.e2e.agent.common.util.OkHttpUtils;
+import org.apache.shardingsphere.test.e2e.agent.zipkin.asserts.SpanAssert;
+import org.apache.shardingsphere.test.e2e.agent.zipkin.cases.IntegrationTestCasesLoader;
+import org.apache.shardingsphere.test.e2e.agent.zipkin.cases.SpanTestCase;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.List;
+import java.util.Collection;
import java.util.Properties;
-import java.util.Set;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import java.util.concurrent.TimeUnit;
+@RunWith(Parameterized.class)
public final class ZipkinPluginE2EIT extends BasePluginE2EIT {
+ private final SpanTestCase spanTestCase;
+
private Properties props;
private String url;
- private String serviceName;
+ public ZipkinPluginE2EIT(final SpanTestCase spanTestCase) {
+ this.spanTestCase = spanTestCase;
+ }
+
+ @Parameters
+ public static Collection<SpanTestCase> getTestParameters() {
+ return IntegrationTestCasesLoader.getInstance().loadIntegrationTestCases();
+ }
@Before
public void before() {
props = E2ETestEnvironment.getInstance().getProps();
url = props.getProperty("zipkin.url");
- serviceName = props.getProperty("zipkin.servername");
}
@Test
- @SneakyThrows(IOException.class)
+ @SneakyThrows({IOException.class, InterruptedException.class})
public void assertProxyWithAgent() {
super.assertProxyWithAgent();
- assertSpans();
- assertTraces();
- assertTraceContent();
- }
-
- @SneakyThrows(IOException.class)
- private void assertSpans() {
- String spansURL = url + "spans?serviceName=" + serviceName;
- List<?> spans = OkHttpUtils.getInstance().get(spansURL, List.class);
- assertThat(spans.size(), is(3));
- List<String> spanList = Lists.newArrayList("/shardingsphere/executesql/", "/shardingsphere/parsesql/", "/shardingsphere/rootinvoke/");
- spanList.forEach(each -> assertTrue(String.format("Zipkin span `%s` should exist.", each), spans.contains(each)));
- }
-
- @SneakyThrows(IOException.class)
- private void assertTraces() {
- List<String> traceList = Lists.newArrayList(url + "traces?spanName=/shardingsphere/executesql/", url + "traces?spanName=/shardingsphere/parsesql/",
- url + "traces?spanName=/shardingsphere/rootinvoke/");
- for (String each : traceList) {
- assertFalse(String.format("Zipkin trace `%s` should exist.", each), OkHttpUtils.getInstance().get(each, List.class).isEmpty());
- }
- }
-
- @SneakyThrows(IOException.class)
- private void assertTraceContent() {
- Set<String> traceStatement = new LinkedHashSet<>();
- String traceURL = url + "traces?limit=1000";
- List<?> traceResult = OkHttpUtils.getInstance().get(traceURL, List.class);
- List<String> sqlList = Lists.newArrayList("INSERT INTO t_order (order_id, user_id, status) VALUES (10, 10, 'INSERT_TEST')",
- "INSERT INTO t_order (order_id, user_id, status) VALUES (10, 10, 'INSERT_TEST')",
- "DELETE FROM t_order WHERE order_id=10",
- "UPDATE t_order SET status = 'ROLL_BACK' WHERE order_id =1000",
- "SELECT * FROM t_order");
- traceResult.forEach(each -> traceStatement.addAll(extractTraceTags((List<?>) each)));
- sqlList.forEach(each -> assertTrue(String.format("Zipkin trace should contain `%s`.", each), traceStatement.contains(each)));
- }
-
- private Set<String> extractTraceTags(final List<?> zipkinQueryResults) {
- Set<String> result = new LinkedHashSet<>();
- zipkinQueryResults.forEach(each -> {
- LinkedTreeMap<?, ?> trace = (LinkedTreeMap<?, ?>) each;
- LinkedTreeMap<?, ?> tag = (LinkedTreeMap<?, ?>) trace.get("tags");
- if (null != tag.get("db.statement")) {
- result.add(tag.get("db.statement").toString());
- }
- });
- return result;
+ TimeUnit.SECONDS.sleep(5);
+ SpanAssert.assertIs(url, spanTestCase);
}
}
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java
new file mode 100644
index 00000000000..d6552c67509
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java
@@ -0,0 +1,82 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.asserts;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.e2e.agent.common.util.OkHttpUtils;
+import org.apache.shardingsphere.test.e2e.agent.zipkin.cases.SpanTestCase;
+import org.apache.shardingsphere.test.e2e.agent.zipkin.cases.TagAssertion;
+import org.apache.shardingsphere.test.e2e.agent.zipkin.result.SpanResult;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Span assert.
+ */
+public final class SpanAssert {
+
+ /**
+ * Assert span is correct with expected result.
+ *
+ * @param baseUrl zipkin url
+ * @param expected expected span
+ */
+ public static void assertIs(final String baseUrl, final SpanTestCase expected) {
+ for (TagAssertion each : expected.getTagCases()) {
+ assertSpan(baseUrl, expected, each);
+ }
+ }
+
+ private static void assertSpan(final String baseUrl, final SpanTestCase expected, final TagAssertion expectedTagCase) {
+ String tracesApiUrl = getTraceApiUrl(baseUrl, expected, expectedTagCase);
+ List<List<SpanResult>> spanResults = null;
+ try {
+ spanResults = new Gson().fromJson(OkHttpUtils.getInstance().get(tracesApiUrl), new TypeToken<List<List<SpanResult>>>() {
+ }.getType());
+ } catch (final IOException ignored) {
+ }
+ assertNotNull(spanResults);
+ List<SpanResult> spanList = spanResults.stream().findFirst().orElse(Collections.emptyList()).stream()
+ .filter(each -> expected.getSpanName().equalsIgnoreCase(each.getName())).collect(Collectors.toList());
+ assertFalse(expectedTagCase.isNeedAssertValue()
+ ? String.format("The tag `%s`=`%s` does not exist in `%s` span", expectedTagCase.getTagKey(), expectedTagCase.getTagValue(), expected.getSpanName())
+ : String.format("The tag `%s` does not exist in `%s` span", expectedTagCase.getTagKey(), expected.getSpanName()), spanList.isEmpty());
+ }
+
+ private static String getTraceApiUrl(final String baseUrl, final SpanTestCase expected, final TagAssertion expectedTagCase) {
+ String baseTraceApiUrl = String.format("%s/api/v2/traces?serviceName=%s&spanName=%s", baseUrl, getEncodeValue(expected.getServiceName()), getEncodeValue(expected.getSpanName()));
+ return expectedTagCase.isNeedAssertValue()
+ ? String.format("%s&annotationQuery=%s", baseTraceApiUrl, getEncodeValue(String.format("%s=%s", expectedTagCase.getTagKey(), expectedTagCase.getTagValue())))
+ : String.format("%s&annotationQuery=%s", baseTraceApiUrl, getEncodeValue(expectedTagCase.getTagKey()));
+ }
+
+ @SneakyThrows(UnsupportedEncodingException.class)
+ private static String getEncodeValue(final String value) {
+ return URLEncoder.encode(value, "UTF-8");
+ }
+}
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCases.java b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCases.java
new file mode 100644
index 00000000000..6fb5a340874
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCases.java
@@ -0,0 +1,36 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.cases;
+
+import lombok.Getter;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Integration test cases.
+ */
+@Getter
+@XmlRootElement(name = "integration-test-cases")
+public final class IntegrationTestCases {
+
+ @XmlElement(name = "test-case")
+ private final Collection<SpanTestCase> testCases = new LinkedList<>();
+}
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
new file mode 100644
index 00000000000..d389e7aac10
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/IntegrationTestCasesLoader.java
@@ -0,0 +1,101 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.cases;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.SneakyThrows;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Objects;
+
+/**
+ * Integration test cases loader.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class IntegrationTestCasesLoader {
+
+ private static final String FILE_EXTENSION = ".xml";
+
+ private static final IntegrationTestCasesLoader INSTANCE = new IntegrationTestCasesLoader();
+
+ private Collection<SpanTestCase> integrationTestCases;
+
+ /**
+ * Get singleton instance.
+ *
+ * @return singleton instance
+ */
+ public static IntegrationTestCasesLoader getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Load integration test cases.
+ *
+ * @return integration test cases
+ */
+ @SneakyThrows({IOException.class, URISyntaxException.class, JAXBException.class})
+ public Collection<SpanTestCase> loadIntegrationTestCases() {
+ if (null != integrationTestCases) {
+ return integrationTestCases;
+ }
+ integrationTestCases = new LinkedList<>();
+ URL url = Objects.requireNonNull(IntegrationTestCasesLoader.class.getClassLoader().getResource("cases/"));
+ Collection<File> files = getFiles(url);
+ for (File each : files) {
+ integrationTestCases.addAll(unmarshal(each.getPath()).getTestCases());
+ }
+ return integrationTestCases;
+ }
+
+ private static Collection<File> getFiles(final URL url) throws IOException, URISyntaxException {
+ Collection<File> result = new LinkedList<>();
+ Files.walkFileTree(Paths.get(url.toURI()), new SimpleFileVisitor<Path>() {
+
+ @Override
+ public FileVisitResult visitFile(final Path file, final BasicFileAttributes basicFileAttributes) {
+ if (file.getFileName().toString().endsWith(FILE_EXTENSION)) {
+ result.add(file.toFile());
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ return result;
+ }
+
+ private static IntegrationTestCases unmarshal(final String integrateCasesFile) throws IOException, JAXBException {
+ try (FileReader reader = new FileReader(integrateCasesFile)) {
+ return (IntegrationTestCases) JAXBContext.newInstance(IntegrationTestCases.class).createUnmarshaller().unmarshal(reader);
+ }
+ }
+}
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java
new file mode 100644
index 00000000000..39062508dd0
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java
@@ -0,0 +1,45 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.cases;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.Collection;
+
+/**
+ * Span test case.
+ */
+@Getter
+@Setter
+@XmlAccessorType(XmlAccessType.FIELD)
+public final class SpanTestCase {
+
+ @XmlAttribute(name = "service-name")
+ private String serviceName;
+
+ @XmlAttribute(name = "span-name")
+ private String spanName;
+
+ @XmlElement(name = "tag-assertion")
+ private Collection<TagAssertion> tagCases;
+}
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/TagAssertion.java b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/TagAssertion.java
new file mode 100644
index 00000000000..2dccdfc913f
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/TagAssertion.java
@@ -0,0 +1,43 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.cases;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Tag assertion.
+ */
+@Getter
+@Setter
+@XmlAccessorType(XmlAccessType.FIELD)
+public final class TagAssertion {
+
+ @XmlAttribute(name = "key")
+ private String tagKey;
+
+ @XmlAttribute(name = "value")
+ private String tagValue;
+
+ @XmlAttribute(name = "need-assert-value")
+ private boolean needAssertValue;
+}
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/result/LocalEndpoint.java b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/result/LocalEndpoint.java
new file mode 100644
index 00000000000..95f9bd2e550
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/result/LocalEndpoint.java
@@ -0,0 +1,33 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.result;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Local endpoint.
+ */
+@Getter
+@Setter
+public final class LocalEndpoint {
+
+ private String serviceName;
+
+ private String ipv4;
+}
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/result/SpanResult.java b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/result/SpanResult.java
new file mode 100644
index 00000000000..7f477fc90f8
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/result/SpanResult.java
@@ -0,0 +1,45 @@
+/*
+ * 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.shardingsphere.test.e2e.agent.zipkin.result;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Map;
+
+/**
+ * Span result.
+ */
+@Getter
+@Setter
+public class SpanResult {
+
+ private String traceId;
+
+ private String id;
+
+ private String name;
+
+ private long timestamp;
+
+ private long duration;
+
+ private LocalEndpoint localEndpoint;
+
+ private Map<String, String> tags;
+}
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/execute_sql.xml
new file mode 100644
index 00000000000..1418e786f19
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/execute_sql.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<integration-test-cases>
+ <test-case service-name="shardingsphere" span-name="/shardingsphere/executesql/">
+ <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.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" />
+ <tag-assertion key="db.bind_vars" />
+ <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" />
+ </test-case>
+</integration-test-cases>
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/parse_sql.xml
new file mode 100644
index 00000000000..85e492d73e0
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/parse_sql.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<integration-test-cases>
+ <test-case service-name="shardingsphere" span-name="/shardingsphere/parsesql/">
+ <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" />
+ </test-case>
+</integration-test-cases>
diff --git a/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/root_invoke.xml b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/root_invoke.xml
new file mode 100644
index 00000000000..201d836a772
--- /dev/null
+++ b/test/e2e/agent/plugins/tracing/zipkin/src/test/resources/cases/root_invoke.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<integration-test-cases>
+ <test-case service-name="shardingsphere" span-name="/shardingsphere/rootinvoke/">
+ <tag-assertion key="component" value="ShardingSphere" need-assert-value="true" />
+ <tag-assertion key="span.kind" value="client" need-assert-value="true" />
+ </test-case>
+</integration-test-cases>
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 333476ffddd..e139488ed22 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,4 @@ proxy.url=jdbc:mysql://127.0.0.1:43071/agent-tracing-zipkin-db?serverTimezone=UT
proxy.username=root
proxy.password=root
-zipkin.url=http://127.0.0.1:19411/api/v2/
-zipkin.servername=shardingsphere
+zipkin.url=http://127.0.0.1:19411