You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Pace2Car (via GitHub)" <gi...@apache.org> on 2023/02/06 06:03:25 UTC

[GitHub] [shardingsphere] Pace2Car commented on a diff in pull request #24016: Fix SET DIST VARIABLE system-log-level

Pace2Car commented on code in PR #24016:
URL: https://github.com/apache/shardingsphere/pull/24016#discussion_r1096974232


##########
proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutorTest.java:
##########
@@ -92,4 +89,38 @@ public void assertExecuteWithConfigurationKey() throws SQLException {
         assertThat(actualValue.toString(), is("1024"));
         assertThat(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.PROXY_FRONTEND_FLUSH_THRESHOLD), is(1024));
     }
+    
+    @Test
+    public void assertExecuteWithSystemLogLevel() throws SQLException {
+        ContextManager contextManager = mockContextManager();
+        SetDistVariableStatement statement = new SetDistVariableStatement("system_log_level", "debug");
+        SetDistVariableHandler handler = new SetDistVariableHandler();
+        handler.init(statement, connectionSession);
+        handler.execute();
+        Object actualValue = contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("system-log-level");
+        assertThat(actualValue.toString(), is("DEBUG"));
+        assertThat(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.SYSTEM_LOG_LEVEL), is(LoggerLevel.DEBUG));
+    }
+    
+    @Test(expected = InvalidValueException.class)
+    public void assertExecuteWithWrongSystemLogLevel() throws SQLException {
+        ContextManager contextManager = mockContextManager();
+        SetDistVariableStatement statement = new SetDistVariableStatement("system_log_level", "debag");
+        SetDistVariableHandler handler = new SetDistVariableHandler();
+        handler.init(statement, connectionSession);
+        handler.execute();
+        Object actualValue = contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("system-log-level");
+        assertThat(actualValue.toString(), is("DEBUG"));

Review Comment:
   Thanks for pointing it out, I've removed the redundant code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org