You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2024/12/06 02:55:32 UTC

(iotdb) branch master updated: Fix auth test (#14337)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f8176b7146b Fix auth test (#14337)
f8176b7146b is described below

commit f8176b7146bab8e7ac1cd3c824d6bad4c4dc11c1
Author: Jiang Tian <jt...@163.com>
AuthorDate: Fri Dec 6 10:55:26 2024 +0800

    Fix auth test (#14337)
---
 .../db/queryengine/plan/relational/analyzer/AuthTest.java      | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AuthTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AuthTest.java
index 83f8067c59c..468e7e99df5 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AuthTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AuthTest.java
@@ -207,7 +207,9 @@ public class AuthTest {
       String userName,
       ITableAuthChecker authChecker,
       String databaseNameInSessionInfo) {
-    Statement statement = sqlParser.createStatement(sql, zoneId);
+    IClientSession clientSession = Mockito.mock(IClientSession.class);
+    Mockito.when(clientSession.getDatabaseName()).thenReturn(databaseNameInSessionInfo);
+    Statement statement = sqlParser.createStatement(sql, zoneId, clientSession);
     SessionInfo session =
         new SessionInfo(
             0, userName, zoneId, databaseNameInSessionInfo, IClientSession.SqlDialect.TABLE);
@@ -226,7 +228,9 @@ public class AuthTest {
   }
 
   private void analyzeConfigTask(String sql, String userName, ITableAuthChecker authChecker) {
-    Statement statement = sqlParser.createStatement(sql, zoneId);
+    IClientSession clientSession = Mockito.mock(IClientSession.class);
+    Mockito.when(clientSession.getDatabaseName()).thenReturn(null);
+    Statement statement = sqlParser.createStatement(sql, zoneId, clientSession);
     SessionInfo session =
         new SessionInfo(0, userName, zoneId, null, IClientSession.SqlDialect.TABLE);
     MPPQueryContext context = new MPPQueryContext(sql, QUERY_ID, 0, session, null, null);
@@ -239,7 +243,7 @@ public class AuthTest {
 
   private void analyzeConfigTask(
       String sql, String userName, ITableAuthChecker authChecker, IClientSession clientSession) {
-    Statement statement = sqlParser.createStatement(sql, zoneId);
+    Statement statement = sqlParser.createStatement(sql, zoneId, clientSession);
     SessionInfo session =
         new SessionInfo(0, userName, zoneId, null, IClientSession.SqlDialect.TABLE);
     MPPQueryContext context = new MPPQueryContext(sql, QUERY_ID, 0, session, null, null);