HBASE-19579 Add peer lock test for shell command list_locks

Signed-off-by: zhangduo <zhangduo@apache.org>
This commit is contained in:
Guanghao Zhang 2017-12-23 21:04:27 +08:00 committed by zhangduo
parent 15055a421b
commit 59cad95b58
2 changed files with 20 additions and 0 deletions

View File

@ -77,6 +77,7 @@ enum LockedResourceType {
NAMESPACE = 2;
TABLE = 3;
REGION = 4;
PEER = 5;
}
message LockedResource {

View File

@ -67,6 +67,25 @@ module Hbase
proc_id)
end
define_test 'list peer locks' do
lock = create_exclusive_lock(0)
peer_id = '1'
@scheduler.waitPeerExclusiveLock(lock, peer_id)
output = capture_stdout { @list_locks.command }
@scheduler.wakePeerExclusiveLock(lock, peer_id)
assert_equal(
"PEER(1)\n" \
"Lock type: EXCLUSIVE, procedure: {" \
"\"className\"=>\"org.apache.hadoop.hbase.master.locking.LockProcedure\", " \
"\"procId\"=>\"0\", \"submittedTime\"=>\"0\", \"state\"=>\"RUNNABLE\", " \
"\"lastUpdate\"=>\"0\", " \
"\"stateMessage\"=>[{\"lockType\"=>\"EXCLUSIVE\", \"description\"=>\"description\"}]" \
"}\n\n",
output)
end
define_test 'list server locks' do
lock = create_exclusive_lock(0)