You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2022/10/28 01:36:27 UTC
[shardingsphere] branch master updated: Enable show processlist it. (#21797)
This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 54617998736 Enable show processlist it. (#21797)
54617998736 is described below
commit 54617998736ad9139453107ddc63a5dedff8b3cb
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Fri Oct 28 09:36:20 2022 +0800
Enable show processlist it. (#21797)
* Enable show processlist it.
* Revert "Enable show processlist it."
This reverts commit f5ef9f83
---
.github/workflows/it-showprocesslist.yml | 82 ++++++++++++++++++++++
.../showprocesslist/engine/ShowProcessListIT.java | 25 ++++---
2 files changed, 96 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/it-showprocesslist.yml b/.github/workflows/it-showprocesslist.yml
new file mode 100644
index 00000000000..0975f8899dc
--- /dev/null
+++ b/.github/workflows/it-showprocesslist.yml
@@ -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.
+#
+
+name: IT - ShowProcesslist
+
+on:
+ push:
+ branches: [ master, dev ]
+ paths:
+ - '.github/workflows/it-showprocesslist.yml'
+ - 'infra/common/src/main/**'
+ - 'mode/**/src/main/**'
+ - 'proxy/**/src/main/**'
+ - 'jdbc/core/src/main/**'
+ - '!test/**'
+ - 'test/pom.xml'
+ - 'test/integration-test/fixture/**'
+ - 'test/integration-test/env/**'
+ - 'test/integration-test/showprocesslist/**'
+ - '!*.md'
+ pull_request:
+ branches: [ master ]
+ paths:
+ - '.github/workflows/it-showprocesslist.yml'
+ - 'infra/common/src/main/**'
+ - 'mode/**/src/main/**'
+ - 'proxy/**/src/main/**'
+ - 'jdbc/core/src/main/**'
+ - '!test/**'
+ - 'test/pom.xml'
+ - 'test/integration-test/fixture/**'
+ - 'test/integration-test/env/**'
+ - 'test/integration-test/showprocesslist/**'
+ - '!*.md'
+
+concurrency:
+ group: it-showprocesslist-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+env:
+ MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Djacoco.skip=true -Dfailsafe.skipAfterFailureCount=1 -Dio.netty.leakDetectionLevel=advanced
+
+jobs:
+ showprocesslist-it-test:
+ name: showprocesslist-it-test
+ runs-on: ubuntu-latest
+ env:
+ mysql_version: 5.7
+ timeout-minutes: 10
+ steps:
+ - uses: actions/checkout@v3
+ - name: Cache Maven Repos
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2/repository
+ key: shardingsphere-maven-third-party-it-cache${{ github.sha }}
+ restore-keys: |
+ shardingsphere-maven-third-party-it-cache
+ shardingsphere-maven-third-party-
+ - name: Set up JDK 8
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'temurin'
+ java-version: 8
+ - name: Build ShowProcesslist IT image
+ run: ./mvnw -B clean install -am -pl test/integration-test/showprocesslist -Pit.env.docker -DskipTests
+ - name: Run MySQL ShowProcesslist Integration Test
+ run: ./mvnw -nsu -B install -f test/integration-test/showprocesslist/pom.xml -Dit.env.type=docker -Dit.scenarios=cluster_jdbc_proxy
diff --git a/test/integration-test/showprocesslist/src/test/java/org/apache/shardingsphere/test/integration/showprocesslist/engine/ShowProcessListIT.java b/test/integration-test/showprocesslist/src/test/java/org/apache/shardingsphere/test/integration/showprocesslist/engine/ShowProcessListIT.java
index 60bbb544ef9..74d57e2e965 100644
--- a/test/integration-test/showprocesslist/src/test/java/org/apache/shardingsphere/test/integration/showprocesslist/engine/ShowProcessListIT.java
+++ b/test/integration-test/showprocesslist/src/test/java/org/apache/shardingsphere/test/integration/showprocesslist/engine/ShowProcessListIT.java
@@ -40,14 +40,15 @@ import java.util.concurrent.CompletableFuture;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
-// TODO add workflow, add jdbc
+// TODO add jdbc
@RunWith(Parameterized.class)
public final class ShowProcessListIT {
private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
+ private static final String SELECT_SLEEP = "select sleep(10)";
+
private final ClusterShowProcessListContainerComposer containerComposer;
public ShowProcessListIT(final ShowProcessListParameterized parameterized) {
@@ -77,17 +78,15 @@ public final class ShowProcessListIT {
@Test
public void assertShowProcessList() throws SQLException, InterruptedException {
- CompletableFuture<Void> executeSelectSleep1 = CompletableFuture.runAsync(getExecuteSleepThread("proxy"));
- CompletableFuture<Void> executeSelectSleep2 = CompletableFuture.runAsync(getExecuteSleepThread("proxy"));
- CompletableFuture<Void> executeSelectSleep3 = CompletableFuture.runAsync(getExecuteSleepThread("proxy"));
- Thread.sleep(100);
+ CompletableFuture<Void> executeSelectSleep = CompletableFuture.runAsync(getExecuteSleepThread("proxy"));
+ Thread.sleep(5000);
try (
Connection connection = containerComposer.getProxyDataSource().getConnection();
Statement statement = connection.createStatement()) {
ResultSet resultSet = statement.executeQuery("show processlist");
assertResultSet(resultSet);
}
- CompletableFuture.allOf(executeSelectSleep1, executeSelectSleep2, executeSelectSleep3).join();
+ executeSelectSleep.join();
}
private void assertResultSet(final ResultSet resultSet) throws SQLException {
@@ -100,9 +99,13 @@ public final class ShowProcessListIT {
}
private void assertRows(final ResultSet resultSet) throws SQLException {
- assertTrue(resultSet.next());
- assertTrue(resultSet.next());
- assertTrue(resultSet.next());
+ int count = 0;
+ while (resultSet.next()) {
+ if (SELECT_SLEEP.equals(resultSet.getObject(8).toString())) {
+ count++;
+ }
+ }
+ assertThat(count, is(1));
}
private Runnable getExecuteSleepThread(final String targetContainer) {
@@ -110,7 +113,7 @@ public final class ShowProcessListIT {
try (
Connection connection = "proxy".equals(targetContainer) ? containerComposer.getProxyDataSource().getConnection() : containerComposer.getJdbcDataSource().getConnection();
Statement statement = connection.createStatement()) {
- statement.executeQuery("select sleep(10)");
+ statement.executeQuery(SELECT_SLEEP);
} catch (SQLException ex) {
throw new RuntimeException(ex);
}