Repository: hbase Updated Branches: refs/heads/branch-2 43adfa9b0 -> 7ffe1f10e
HBASE-16120 Add shell test for truncate_preserve Signed-off-by: Michael Stack <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7ffe1f10 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7ffe1f10 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7ffe1f10 Branch: refs/heads/branch-2 Commit: 7ffe1f10e8937bd46729dfd25ba4911a835b551f Parents: 43adfa9 Author: Guangxu Cheng <[email protected]> Authored: Wed May 31 21:25:37 2017 +0800 Committer: Michael Stack <[email protected]> Committed: Wed Jul 5 12:51:57 2017 -0700 ---------------------------------------------------------------------- hbase-shell/src/test/ruby/hbase/admin_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/7ffe1f10/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 29ab37a..60fc43b 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -281,6 +281,22 @@ module Hbase assert(!output.empty?) end + #------------------------------------------------------------------------------- + + define_test "truncate_preserve should empty a table" do + table(@test_name).put(1, "x:a", 1) + table(@test_name).put(2, "x:a", 2) + assert_equal(2, table(@test_name)._count_internal) + # This is hacky. Need to get the configuration into admin instance + command(:truncate_preserve, @test_name) + assert_equal(0, table(@test_name)._count_internal) + end + + define_test "truncate_preserve should yield log records" do + output = capture_stdout { command(:truncate_preserve, @test_name) } + assert(!output.empty?) + end + define_test "truncate_preserve should maintain the previous region boundaries" do drop_test_table(@create_test_name) admin.create(@create_test_name, 'a', {NUMREGIONS => 10, SPLITALGO => 'HexStringSplit'})
