Repository: hbase Updated Branches: refs/heads/master 24435f65a -> 619d6a50f
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/619d6a50 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/619d6a50 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/619d6a50 Branch: refs/heads/master Commit: 619d6a50f6e0037d017fbac88274e3e85643cbf3 Parents: 24435f6 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:36 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/619d6a50/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'})
