HBASE-20253. Error message is missing for restore_snapshot
Amending Author: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
parent
3eee7d37f4
commit
bf7c631dee
|
@ -117,6 +117,9 @@ module Shell
|
||||||
if cause.is_a?(org.apache.hadoop.hbase.TableNotEnabledException)
|
if cause.is_a?(org.apache.hadoop.hbase.TableNotEnabledException)
|
||||||
raise "Table #{args.first} is disabled!"
|
raise "Table #{args.first} is disabled!"
|
||||||
end
|
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)
|
if cause.is_a?(org.apache.hadoop.hbase.UnknownRegionException)
|
||||||
raise "Unknown region #{args.first}!"
|
raise "Unknown region #{args.first}!"
|
||||||
end
|
end
|
||||||
|
|
|
@ -582,7 +582,8 @@ module Hbase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Simple administration methods tests
|
# Simple administration methods tests
|
||||||
|
# rubocop:disable ClassLength
|
||||||
class AdminSnapshotTest < Test::Unit::TestCase
|
class AdminSnapshotTest < Test::Unit::TestCase
|
||||||
include TestHelpers
|
include TestHelpers
|
||||||
|
|
||||||
|
@ -651,20 +652,33 @@ module Hbase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
define_test "Restore snapshot should work" do
|
define_test 'Restore snapshot should work' do
|
||||||
drop_test_snapshot()
|
drop_test_snapshot
|
||||||
restore_table = "test_restore_snapshot_table"
|
restore_table = 'test_restore_snapshot_table'
|
||||||
command(:create, restore_table, 'f1', 'f2')
|
command(:create, restore_table, 'f1', 'f2')
|
||||||
assert_match(eval("/" + "f1" + "/"), admin.describe(restore_table))
|
assert_match(/f1/, admin.describe(restore_table))
|
||||||
assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table))
|
assert_match(/f2/, admin.describe(restore_table))
|
||||||
command(:snapshot, restore_table, @create_test_snapshot)
|
command(:snapshot, restore_table, @create_test_snapshot)
|
||||||
command(:alter, restore_table, METHOD => 'delete', NAME => 'f1')
|
command(:alter, restore_table, METHOD => 'delete', NAME => 'f1')
|
||||||
assert_no_match(eval("/" + "f1" + "/"), admin.describe(restore_table))
|
assert_no_match(/f1/, admin.describe(restore_table))
|
||||||
assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table))
|
assert_match(/f2/, admin.describe(restore_table))
|
||||||
drop_test_table(restore_table)
|
drop_test_table(restore_table)
|
||||||
command(:restore_snapshot, @create_test_snapshot)
|
command(:restore_snapshot, @create_test_snapshot)
|
||||||
assert_match(eval("/" + "f1" + "/"), admin.describe(restore_table))
|
assert_match(/f1/, admin.describe(restore_table))
|
||||||
assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table))
|
assert_match(/f2/, admin.describe(restore_table))
|
||||||
|
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(/f1/, admin.describe(restore_table))
|
||||||
|
assert_match(/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)
|
drop_test_table(restore_table)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -784,4 +798,5 @@ module Hbase
|
||||||
drop_test_table(new_table)
|
drop_test_table(new_table)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop:enable ClassLength
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue