Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion hbase-shell/src/main/ruby/shell/commands/list_labels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ def help

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,17 @@ def teardown
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