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

liuxiaocs7 pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new 477512166ff HBASE-30283 list_labels shell command should return 
readable labels (#8461)
477512166ff is described below

commit 477512166ff7eca51dbfbdafdad53e6b0588886a
Author: Xiao Liu <[email protected]>
AuthorDate: Wed Jul 15 11:17:26 2026 +0800

    HBASE-30283 list_labels shell command should return readable labels (#8461)
    
    Signed-off-by: Peng Lu <[email protected]>
---
 hbase-shell/src/main/ruby/shell/commands/list_labels.rb      |  6 +++++-
 .../test/ruby/hbase/visibility_labels_admin_test_cluster.rb  | 12 ++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/hbase-shell/src/main/ruby/shell/commands/list_labels.rb 
b/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
index 8619642351a..50cc704c44c 100644
--- a/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/list_labels.rb
@@ -33,9 +33,13 @@ EOF
 
       def command(regex = '.*')
         list = visibility_labels_admin.list_labels(regex)
+        labels = []
         list.each do |label|
-          
formatter.row([org.apache.hadoop.hbase.util.Bytes.toStringBinary(label.toByteArray)])
+          label_string = 
org.apache.hadoop.hbase.util.Bytes.toStringBinary(label.toByteArray)
+          formatter.row([label_string])
+          labels << label_string
         end
+        labels
       end
     end
   end
diff --git 
a/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test_cluster.rb 
b/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test_cluster.rb
index b59b9b9065f..b0b440b3a46 100644
--- a/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test_cluster.rb
+++ b/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test_cluster.rb
@@ -86,5 +86,17 @@ module Hbase
       assert_not_nil(res['x:a'])
     end
 
+    define_test "list_labels should return an Array of readable label Strings" 
do
+      label = 'TEST_LIST_LABELS'
+      command(:add_labels, label)
+      $TEST_CLUSTER.waitLabelAvailable(10000, label)
+
+      labels = command(:list_labels, 'TEST_.*')
+      assert_kind_of(Array, labels)
+      labels.each { |l| assert_kind_of(String, l) }
+      assert(labels.include?(label),
+             "list_labels should include the created label #{label}")
+    end
+
   end
 end

Reply via email to