HBASE-11445 TestZKProcedure#testMultiCohortWithMemberTimeoutDuringPrepare is flaky (Jeffrey Zhong)
This commit is contained in:
parent
c70da8b278
commit
f509f61a40
|
@ -266,17 +266,15 @@ public class TestZKProcedure {
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass out a task per member
|
// pass out a task per member
|
||||||
final int[] i = new int[] { 0 };
|
final AtomicInteger taskIndex = new AtomicInteger();
|
||||||
Mockito.when(
|
Mockito.when(
|
||||||
subprocFactory.buildSubprocedure(Mockito.eq(opName),
|
subprocFactory.buildSubprocedure(Mockito.eq(opName),
|
||||||
(byte[]) Mockito.argThat(new ArrayEquals(data)))).thenAnswer(
|
(byte[]) Mockito.argThat(new ArrayEquals(data)))).thenAnswer(
|
||||||
new Answer<Subprocedure>() {
|
new Answer<Subprocedure>() {
|
||||||
@Override
|
@Override
|
||||||
public Subprocedure answer(InvocationOnMock invocation) throws Throwable {
|
public Subprocedure answer(InvocationOnMock invocation) throws Throwable {
|
||||||
int index = i[0];
|
int index = taskIndex.getAndIncrement();
|
||||||
Subprocedure commit = cohortTasks.get(index);
|
Subprocedure commit = cohortTasks.get(index);
|
||||||
index++;
|
|
||||||
i[0] = index;
|
|
||||||
return commit;
|
return commit;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue