liuxiaocs7 commented on code in PR #7931:
URL: https://github.com/apache/hbase/pull/7931#discussion_r2978824165


##########
hbase-shell/src/test/ruby/shell/general_test_cluster.rb:
##########
@@ -149,4 +151,70 @@ class TestException < RuntimeError; end
     # create a table that exists
     @shell.command('create', 'nothrow_table', 'family_1')
   end
+
+  
#-----------------------------------------------------------------------------
+
+  class MockInputMethod < IRB::InputMethod
+    def initialize(lines)
+      super()
+      @lines = lines
+    end
+    def gets
+      @lines.shift
+    end
+    def eof?
+      @lines.empty?
+    end
+    def encoding
+      Encoding::UTF_8
+    end
+    def readable_after_eof?
+      false
+    end
+  end
+
+  define_test 'Shell::Shell should prevent HBase commands from being shadowed 
by local variables (HBASE-28660)' do
+    workspace = @shell.get_workspace
+    IRB.setup(__FILE__) unless IRB.conf[:IRB_NAME]
+
+    lines = [
+      "list = 10\n",
+      "list_namespace, 'ns.*'\n",
+      "my_var = 5\n"
+    ]

Review Comment:
   In HBASE-28660 discussion, it seems that these commands(`list`, 
`list_namespace`, `list_snapshot`, `scan`, `processlist`) have been affected. 
can we add them all to the unit tests?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to