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 e0be1958b7
commit 3c6ac6d3f8
No known key found for this signature in database
GPG Key ID: 8E6C8FEDCA866394
1 changed files with 5 additions and 2 deletions

View File

@ -138,8 +138,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();
}
@ -156,9 +160,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){