HBASE-21952 Fix unit test: TestClientOperationInterrupt#testInterrupt50Percent

This commit is contained in:
Xu cang 2019-02-27 13:19:13 -08:00 committed by Xu Cang
parent 77a7e707ca
commit 3b1e56ec36
No known key found for this signature in database
GPG Key ID: 8E6C8FEDCA866394
1 changed files with 5 additions and 2 deletions

View File

@ -127,8 +127,12 @@ public class TestClientOperationInterrupt {
threads.add(t);
t.start();
}
int expectedNoExNum = nbThread / 2;
for (int i = 0; i < nbThread / 2; i++) {
if (threads.get(i).getState().equals(Thread.State.TERMINATED)) {
expectedNoExNum--;
}
threads.get(i).interrupt();
}
@ -145,9 +149,8 @@ public class TestClientOperationInterrupt {
}
Assert.assertFalse(Thread.currentThread().isInterrupted());
Assert.assertTrue(" noEx: " + noEx.get() + ", badEx=" + badEx.get() + ", noInt=" + noInt.get(),
noEx.get() == nbThread / 2 && badEx.get() == 0);
noEx.get() == expectedNoExNum && badEx.get() == 0);
// The problem here is that we need the server to free its handlers to handle all operations
while (done.get() != nbThread){