hbase git commit: HBASE-20253. Error message is missing for restore_snapshot
Repository: hbase Updated Branches: refs/heads/branch-2.0 b3ec5f0ab -> 9320c5d9b HBASE-20253. Error message is missing for restore_snapshot Amending Author: Peter SomogyiProject: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9320c5d9 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9320c5d9 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9320c5d9 Branch: refs/heads/branch-2.0 Commit: 9320c5d9b8edb8b65513a9308d49bf9f91290ace Parents: b3ec5f0 Author: Gabor Bota Authored: Mon Apr 9 14:28:11 2018 +0200 Committer: Peter Somogyi Committed: Wed Apr 11 17:26:01 2018 +0200 -- hbase-shell/src/main/ruby/shell/commands.rb | 3 ++ hbase-shell/src/test/ruby/hbase/admin_test.rb | 37 +++--- 2 files changed, 29 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/9320c5d9/hbase-shell/src/main/ruby/shell/commands.rb -- diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index b4a3407..095e438 100644 --- a/hbase-shell/src/main/ruby/shell/commands.rb +++ b/hbase-shell/src/main/ruby/shell/commands.rb @@ -117,6 +117,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 http://git-wip-us.apache.org/repos/asf/hbase/blob/9320c5d9/hbase-shell/src/test/ruby/hbase/admin_test.rb -- diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index a27bbc5..a3bf0f4 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -361,7 +361,7 @@ module Hbase end end - # Simple administration methods tests + # Simple administration methods tests class AdminAlterTableTest < Test::Unit::TestCase include TestHelpers @@ -582,7 +582,8 @@ module Hbase end end -# Simple administration methods tests + # Simple administration methods tests + # rubocop:disable ClassLength class AdminSnapshotTest < Test::Unit::TestCase include TestHelpers @@ -651,20 +652,33 @@ module Hbase end end -define_test "Restore snapshot should work" do - drop_test_snapshot() - restore_table = "test_restore_snapshot_table" +define_test 'Restore snapshot should work' 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)) + assert_match(/f1/, admin.describe(restore_table)) + assert_match(/f2/, admin.describe(restore_table)) command(:snapshot, restore_table, @create_test_snapshot) command(:alter, restore_table, METHOD => 'delete', NAME => 'f1') - assert_no_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) - assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + assert_no_match(/f1/, admin.describe(restore_table)) + assert_match(/f2/, admin.describe(restore_table)) drop_test_table(restore_table) command(:restore_snapshot, @create_test_snapshot) - assert_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) - assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + assert_match(/f1/, 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) end @@ -784,4 +798,5 @@ module Hbase drop_test_table(new_table) end end + # rubocop:enable ClassLength end
hbase git commit: HBASE-20253. Error message is missing for restore_snapshot
Repository: hbase Updated Branches: refs/heads/branch-2 3eee7d37f -> bf7c631de HBASE-20253. Error message is missing for restore_snapshot Amending Author: Peter SomogyiProject: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bf7c631d Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bf7c631d Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bf7c631d Branch: refs/heads/branch-2 Commit: bf7c631deeb21c8618d08db5f1dda4c124771ef4 Parents: 3eee7d3 Author: Gabor Bota Authored: Mon Apr 9 14:28:11 2018 +0200 Committer: Peter Somogyi Committed: Wed Apr 11 17:25:32 2018 +0200 -- hbase-shell/src/main/ruby/shell/commands.rb | 3 ++ hbase-shell/src/test/ruby/hbase/admin_test.rb | 37 +++--- 2 files changed, 29 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/bf7c631d/hbase-shell/src/main/ruby/shell/commands.rb -- diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index b4a3407..095e438 100644 --- a/hbase-shell/src/main/ruby/shell/commands.rb +++ b/hbase-shell/src/main/ruby/shell/commands.rb @@ -117,6 +117,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 http://git-wip-us.apache.org/repos/asf/hbase/blob/bf7c631d/hbase-shell/src/test/ruby/hbase/admin_test.rb -- diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index a27bbc5..a3bf0f4 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -361,7 +361,7 @@ module Hbase end end - # Simple administration methods tests + # Simple administration methods tests class AdminAlterTableTest < Test::Unit::TestCase include TestHelpers @@ -582,7 +582,8 @@ module Hbase end end -# Simple administration methods tests + # Simple administration methods tests + # rubocop:disable ClassLength class AdminSnapshotTest < Test::Unit::TestCase include TestHelpers @@ -651,20 +652,33 @@ module Hbase end end -define_test "Restore snapshot should work" do - drop_test_snapshot() - restore_table = "test_restore_snapshot_table" +define_test 'Restore snapshot should work' 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)) + assert_match(/f1/, admin.describe(restore_table)) + assert_match(/f2/, admin.describe(restore_table)) command(:snapshot, restore_table, @create_test_snapshot) command(:alter, restore_table, METHOD => 'delete', NAME => 'f1') - assert_no_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) - assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + assert_no_match(/f1/, admin.describe(restore_table)) + assert_match(/f2/, admin.describe(restore_table)) drop_test_table(restore_table) command(:restore_snapshot, @create_test_snapshot) - assert_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) - assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + assert_match(/f1/, 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) end @@ -784,4 +798,5 @@ module Hbase drop_test_table(new_table) end end + # rubocop:enable ClassLength end
hbase git commit: HBASE-20253. Error message is missing for restore_snapshot
Repository: hbase Updated Branches: refs/heads/master 37e5b0b1b -> 118c1a1f2 HBASE-20253. Error message is missing for restore_snapshot Amending Author: Peter SomogyiProject: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/118c1a1f Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/118c1a1f Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/118c1a1f Branch: refs/heads/master Commit: 118c1a1f2fce9318bfbff88ae911f4919373aac1 Parents: 37e5b0b Author: Gabor Bota Authored: Mon Apr 9 14:28:11 2018 +0200 Committer: Peter Somogyi Committed: Wed Apr 11 17:24:36 2018 +0200 -- hbase-shell/src/main/ruby/shell/commands.rb | 3 ++ hbase-shell/src/test/ruby/hbase/admin_test.rb | 37 +++--- 2 files changed, 29 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/118c1a1f/hbase-shell/src/main/ruby/shell/commands.rb -- diff --git a/hbase-shell/src/main/ruby/shell/commands.rb b/hbase-shell/src/main/ruby/shell/commands.rb index 9fd634c..f63128f 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 http://git-wip-us.apache.org/repos/asf/hbase/blob/118c1a1f/hbase-shell/src/test/ruby/hbase/admin_test.rb -- diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index a27bbc5..a3bf0f4 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -361,7 +361,7 @@ module Hbase end end - # Simple administration methods tests + # Simple administration methods tests class AdminAlterTableTest < Test::Unit::TestCase include TestHelpers @@ -582,7 +582,8 @@ module Hbase end end -# Simple administration methods tests + # Simple administration methods tests + # rubocop:disable ClassLength class AdminSnapshotTest < Test::Unit::TestCase include TestHelpers @@ -651,20 +652,33 @@ module Hbase end end -define_test "Restore snapshot should work" do - drop_test_snapshot() - restore_table = "test_restore_snapshot_table" +define_test 'Restore snapshot should work' 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)) + assert_match(/f1/, admin.describe(restore_table)) + assert_match(/f2/, admin.describe(restore_table)) command(:snapshot, restore_table, @create_test_snapshot) command(:alter, restore_table, METHOD => 'delete', NAME => 'f1') - assert_no_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) - assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + assert_no_match(/f1/, admin.describe(restore_table)) + assert_match(/f2/, admin.describe(restore_table)) drop_test_table(restore_table) command(:restore_snapshot, @create_test_snapshot) - assert_match(eval("/" + "f1" + "/"), admin.describe(restore_table)) - assert_match(eval("/" + "f2" + "/"), admin.describe(restore_table)) + assert_match(/f1/, 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) end @@ -784,4 +798,5 @@ module Hbase drop_test_table(new_table) end end + # rubocop:enable ClassLength end