From 626089c5d60bfae2c6a818096bfbb42c6c7e7d55 Mon Sep 17 00:00:00 2001 From: Gabor Bota Date: Mon, 9 Apr 2018 14:28:11 +0200 Subject: [PATCH] HBASE-20253. Error message is missing for restore_snapshot --- hbase-shell/src/main/ruby/shell/commands.rb | 3 +++ hbase-shell/src/test/ruby/hbase/admin_test.rb | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index 9fd634cc4f..f63128f761 100644 --- a/hbase-shell/src/main/ruby/shell/commands.rb +++ b/hbase-shell/src/main/ruby/shell/commands.rb @@ -119,6 +119,9 @@ module Shell if cause.is_a?(org.apache.hadoop.hbase.TableNotEnabledException) raise "Table #{args.first} is disabled!" end + if cause.is_a?(org.apache.hadoop.hbase.TableNotDisabledException) + raise "Table #{cause.message} should be disabled!" + end if cause.is_a?(org.apache.hadoop.hbase.UnknownRegionException) raise "Unknown region #{args.first}!" end diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index a27bbc5082..3226ac41d9 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -668,6 +668,19 @@ module Hbase drop_test_table(restore_table) end + define_test "Restore snapshot should fail" do + drop_test_snapshot() + restore_table = "test_restore_snapshot_table" + command(:create, restore_table, 'f1', 'f2') + assert_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) + assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + command(:snapshot, restore_table, @create_test_snapshot) + assert_raise(RuntimeError) do + command(:restore_snapshot, @create_test_snapshot) + end + drop_test_table(restore_table) + end + define_test "Clone snapshot without any args" do assert_raise(ArgumentError) do command(:restore_snapshot) -- 2.15.1 (Apple Git-101)