Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YARN-11744. (3.4) Tackle flaky test testGetRunningContainersToKill #7241

Open
wants to merge 1 commit into
base: branch-3.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1229,20 +1229,24 @@ public void testGetRunningContainersToKill() {
node.getContainersToKill());
}

private static long LAST_TIMESTAMP = 0L;
private static RMContainer newMockRMContainer(boolean isAMContainer,
ExecutionType executionType, String name) {
long now = Time.now();
while (now <= LAST_TIMESTAMP) { now = Time.now(); }
LAST_TIMESTAMP = now;
RMContainer container = mock(RMContainer.class);
when(container.isAMContainer()).thenReturn(isAMContainer);
when(container.getExecutionType()).thenReturn(executionType);
when(container.getCreationTime()).thenReturn(Time.now());
when(container.getCreationTime()).thenReturn(now);
when(container.toString()).thenReturn(name);
return container;
}

/**
* SchedulerNode mock to test launching containers.
*/
class MockSchedulerNode extends SchedulerNode {
static class MockSchedulerNode extends SchedulerNode {
private final List<RMContainer> containers = new ArrayList<>();

MockSchedulerNode() {
Expand Down