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 2022/11/25 07:23:15 UTC

[shardingsphere] branch master updated: Use more precise assert. (#22399)

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 7dc6e3b96eb Use more precise assert. (#22399)
7dc6e3b96eb is described below

commit 7dc6e3b96eb505b7f58495e546607a6dfb8db801
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Fri Nov 25 15:23:09 2022 +0800

    Use more precise assert. (#22399)
---
 .../showprocesslist/engine/ShowProcessListIT.java  | 34 ++++++++++++++--------
 1 file changed, 22 insertions(+), 12 deletions(-)

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 1787ee10baa..5687198c2bd 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
@@ -91,6 +91,18 @@ public final class ShowProcessListIT {
         executeSelectSleep.join();
     }
     
+    private Runnable getExecuteSleepThread(final String targetContainer) {
+        return () -> {
+            try (
+                    Connection connection = "proxy".equals(targetContainer) ? containerComposer.getProxyDataSource().getConnection() : containerComposer.getJdbcDataSource().getConnection();
+                    Statement statement = connection.createStatement()) {
+                statement.executeQuery(SELECT_SLEEP);
+            } catch (SQLException ex) {
+                throw new RuntimeException(ex);
+            }
+        };
+    }
+    
     private void assertResultSet(final ResultSet resultSet) throws SQLException {
         assertMetaData(resultSet.getMetaData());
         assertRows(resultSet);
@@ -98,27 +110,25 @@ public final class ShowProcessListIT {
     
     private void assertMetaData(final ResultSetMetaData metaData) throws SQLException {
         assertThat(metaData.getColumnCount(), is(8));
+        assertThat(metaData.getColumnName(1), is("Id"));
+        assertThat(metaData.getColumnName(2), is("User"));
+        assertThat(metaData.getColumnName(3), is("Host"));
+        assertThat(metaData.getColumnName(4), is("db"));
+        assertThat(metaData.getColumnName(5), is("Command"));
+        assertThat(metaData.getColumnName(6), is("Time"));
+        assertThat(metaData.getColumnName(7), is("State"));
+        assertThat(metaData.getColumnName(8), is("Info"));
     }
     
     private void assertRows(final ResultSet resultSet) throws SQLException {
         int count = 0;
         while (resultSet.next()) {
             if (SELECT_SLEEP.equals(resultSet.getObject(8).toString())) {
+                assertThat(resultSet.getObject(5), is("Execute"));
+                assertThat(resultSet.getObject(7), is("Executing 0/1"));
                 count++;
             }
         }
         assertThat(count, is(1));
     }
-    
-    private Runnable getExecuteSleepThread(final String targetContainer) {
-        return () -> {
-            try (
-                    Connection connection = "proxy".equals(targetContainer) ? containerComposer.getProxyDataSource().getConnection() : containerComposer.getJdbcDataSource().getConnection();
-                    Statement statement = connection.createStatement()) {
-                statement.executeQuery(SELECT_SLEEP);
-            } catch (SQLException ex) {
-                throw new RuntimeException(ex);
-            }
-        };
-    }
 }