[ 
https://issues.apache.org/jira/browse/DRILL-6732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16609139#comment-16609139
 ] 

ASF GitHub Bot commented on DRILL-6732:
---------------------------------------

vdiravka commented on a change in pull request #1460: DRILL-6732: Queries are 
runnable on disable plugins
URL: https://github.com/apache/drill/pull/1460#discussion_r216296993
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/exec/store/store/TestDisablePlugin.java
 ##########
 @@ -0,0 +1,56 @@
+package org.apache.drill.exec.store.store;
+
+import org.apache.drill.categories.SqlTest;
+import org.apache.drill.common.exceptions.UserRemoteException;
+import org.apache.drill.exec.store.StoragePluginRegistry;
+import org.apache.drill.exec.store.dfs.FileSystemConfig;
+import org.apache.drill.test.BaseTestQuery;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.ExpectedException;
+
+import java.nio.file.Paths;
+
+import static 
org.apache.drill.exec.util.StoragePluginTestUtils.DFS_PLUGIN_NAME;
+import static org.apache.drill.exec.util.StoragePluginTestUtils.DFS_TMP_SCHEMA;
+import static org.apache.drill.exec.util.StoragePluginTestUtils.TMP_SCHEMA;
+import static org.hamcrest.CoreMatchers.containsString;
+
+@Category(SqlTest.class)
+public class TestDisablePlugin extends BaseTestQuery {
+  private static final String tmp_table = "tmp_plugin_test";
+
+  @Rule
+  public ExpectedException thrown = ExpectedException.none();
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
+    FileSystemConfig pluginConfig = (FileSystemConfig) 
pluginRegistry.getPlugin(DFS_PLUGIN_NAME).getConfig();
+    pluginConfig.setEnabled(false);
+    
dirTestWatcher.makeSubDir(Paths.get(pluginConfig.getWorkspaces().get(TMP_SCHEMA).getLocation(),
 tmp_table));
+    pluginRegistry.createOrUpdate(DFS_PLUGIN_NAME, pluginConfig, true);
+  }
+
+  @AfterClass
+  public static void restore() throws Exception {
+    StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
+    FileSystemConfig pluginConfig = (FileSystemConfig) 
pluginRegistry.getPlugin(DFS_PLUGIN_NAME).getConfig();
+    pluginConfig.setEnabled(true);
+    pluginRegistry.createOrUpdate(DFS_PLUGIN_NAME, pluginConfig, true);
+  }
+
+  @Test
+  public void testDisablePluginQuery() throws Exception {
+    expectUserRemoteExceptionWithMessage(String.format("VALIDATION ERROR: 
Schema [[%s, %s]] is not valid with respect to either root schema or current 
default schema", DFS_PLUGIN_NAME, TMP_SCHEMA));
+    test("select * from %s.%s", DFS_TMP_SCHEMA, tmp_table);
+  }
+
+  private void expectUserRemoteExceptionWithMessage(String message) {
 
 Review comment:
   Move `String.format` to this helper method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Queries are runnable on disable plugins
> ---------------------------------------
>
>                 Key: DRILL-6732
>                 URL: https://issues.apache.org/jira/browse/DRILL-6732
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Security
>    Affects Versions: 1.13.0, 1.14.0
>            Reporter: shuifeng lu
>            Priority: Critical
>             Fix For: 1.15.0
>
>
> Queries are not allowed to run on disable plugins: (1.10 works fine, 1.13 and 
> 1.14 has the same problem. Not checked for 1.11 and 1.12)
> 1) It is not allowed
> 2) the plugin rules cannot be applied on queries, but queries are runnable



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to