HBASE-20801 Fix broken TestReplicationShell

Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6198e1fc
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6198e1fc
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6198e1fc

Branch: refs/heads/master
Commit: 6198e1fc7dfa85c3bc6b2855f9a5fb5f4b2354ff
Parents: 0789e15
Author: zhangduo <zhang...@apache.org>
Authored: Thu Jun 28 10:27:11 2018 +0800
Committer: zhangduo <zhang...@apache.org>
Committed: Thu Jun 28 18:08:43 2018 +0800

----------------------------------------------------------------------
 .../test/ruby/hbase/replication_admin_test.rb   | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6198e1fc/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb 
b/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
index 9d364ce..f44fd8c 100644
--- a/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
@@ -103,7 +103,10 @@ module Hbase
     define_test "add_peer: remote wal dir" do
       cluster_key = "server1.cie.com:2181:/hbase"
       remote_wal_dir = "hdfs://srv1:9999/hbase"
-      args = { CLUSTER_KEY => cluster_key, REMOTE_WAL_DIR => remote_wal_dir }
+      table_cfs = { "ns3:table1" => [], "ns3:table2" => [],
+        "ns3:table3" => [] }
+      args = { CLUSTER_KEY => cluster_key, REMOTE_WAL_DIR => remote_wal_dir,
+        TABLE_CFS => table_cfs}
       command(:add_peer, @peer_id, args)
 
       assert_equal(1, command(:list_peers).length)
@@ -111,6 +114,7 @@ module Hbase
       assert_equal(@peer_id, peer.getPeerId)
       assert_equal(cluster_key, peer.getPeerConfig.getClusterKey)
       assert_equal(remote_wal_dir, peer.getPeerConfig.getRemoteWALDir)
+      assert_tablecfs_equal(table_cfs, peer.getPeerConfig.getTableCFsMap())
 
       # cleanup for future tests
       command(:remove_peer, @peer_id)
@@ -519,7 +523,10 @@ module Hbase
     define_test "transit_peer_sync_replication_state: test" do
       cluster_key = "server1.cie.com:2181:/hbase"
       remote_wal_dir = "hdfs://srv1:9999/hbase"
-      args = { CLUSTER_KEY => cluster_key, REMOTE_WAL_DIR => remote_wal_dir }
+      table_cfs = { "ns3:table1" => [], "ns3:table2" => [],
+        "ns3:table3" => [] }
+      args = { CLUSTER_KEY => cluster_key, REMOTE_WAL_DIR => remote_wal_dir,
+        TABLE_CFS => table_cfs}
       command(:add_peer, @peer_id, args)
 
       assert_equal(1, command(:list_peers).length)
@@ -527,11 +534,18 @@ module Hbase
       assert_equal(@peer_id, peer.getPeerId)
       assert_equal(SyncReplicationState::DOWNGRADE_ACTIVE, 
peer.getSyncReplicationState)
 
-      command(:transit_peer_sync_replication_state, @peer_id, 'ACTIVE')
+      command(:transit_peer_sync_replication_state, @peer_id, 'STANDBY')
       assert_equal(1, command(:list_peers).length)
       peer = command(:list_peers).get(0)
       assert_equal(@peer_id, peer.getPeerId)
-      assert_equal(SyncReplicationState::ACTIVE, peer.getSyncReplicationState)
+      assert_equal(SyncReplicationState::STANDBY, peer.getSyncReplicationState)
+
+      # need to transit back otherwise we can not remove the peer
+      command(:transit_peer_sync_replication_state, @peer_id, 
'DOWNGRADE_ACTIVE')
+      assert_equal(1, command(:list_peers).length)
+      peer = command(:list_peers).get(0)
+      assert_equal(@peer_id, peer.getPeerId)
+      assert_equal(SyncReplicationState::DOWNGRADE_ACTIVE, 
peer.getSyncReplicationState)
 
       # cleanup for future tests
       command(:remove_peer, @peer_id)

Reply via email to