|
@@ -408,16 +408,19 @@ public class TestRMAppAttemptTransitions {
|
|
|
* {@link RMAppAttemptState#RUNNING}
|
|
|
*/
|
|
|
private void testAppAttemptRunningState(Container container,
|
|
|
- String host, int rpcPort, String trackingUrl) {
|
|
|
+ String host, int rpcPort, String trackingUrl, boolean unmanagedAM) {
|
|
|
assertEquals(RMAppAttemptState.RUNNING,
|
|
|
applicationAttempt.getAppAttemptState());
|
|
|
assertEquals(container, applicationAttempt.getMasterContainer());
|
|
|
assertEquals(host, applicationAttempt.getHost());
|
|
|
assertEquals(rpcPort, applicationAttempt.getRpcPort());
|
|
|
assertEquals(trackingUrl, applicationAttempt.getOriginalTrackingUrl());
|
|
|
- assertEquals(getProxyUrl(applicationAttempt),
|
|
|
- applicationAttempt.getTrackingUrl());
|
|
|
-
|
|
|
+ if (unmanagedAM) {
|
|
|
+ assertEquals("oldtrackingurl", applicationAttempt.getTrackingUrl());
|
|
|
+ } else {
|
|
|
+ assertEquals(getProxyUrl(applicationAttempt),
|
|
|
+ applicationAttempt.getTrackingUrl());
|
|
|
+ }
|
|
|
// TODO - need to add more checks relevant to this state
|
|
|
}
|
|
|
|
|
@@ -446,13 +449,18 @@ public class TestRMAppAttemptTransitions {
|
|
|
FinalApplicationStatus finalStatus,
|
|
|
String trackingUrl,
|
|
|
String diagnostics,
|
|
|
- int finishedContainerCount) {
|
|
|
+ int finishedContainerCount, boolean unmanagedAM) {
|
|
|
assertEquals(RMAppAttemptState.FINISHED,
|
|
|
applicationAttempt.getAppAttemptState());
|
|
|
assertEquals(diagnostics, applicationAttempt.getDiagnostics());
|
|
|
assertEquals(trackingUrl, applicationAttempt.getOriginalTrackingUrl());
|
|
|
- assertEquals(getProxyUrl(applicationAttempt),
|
|
|
- applicationAttempt.getTrackingUrl());
|
|
|
+ if (unmanagedAM) {
|
|
|
+ assertEquals("mytrackingurl", applicationAttempt.getTrackingUrl());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ assertEquals(getProxyUrl(applicationAttempt),
|
|
|
+ applicationAttempt.getTrackingUrl());
|
|
|
+ }
|
|
|
assertEquals(finishedContainerCount, applicationAttempt
|
|
|
.getJustFinishedContainers().size());
|
|
|
assertEquals(container, applicationAttempt.getMasterContainer());
|
|
@@ -535,13 +543,14 @@ public class TestRMAppAttemptTransitions {
|
|
|
private void runApplicationAttempt(Container container,
|
|
|
String host,
|
|
|
int rpcPort,
|
|
|
- String trackingUrl) {
|
|
|
+ String trackingUrl, boolean unmanagedAM) {
|
|
|
applicationAttempt.handle(
|
|
|
new RMAppAttemptRegistrationEvent(
|
|
|
applicationAttempt.getAppAttemptId(),
|
|
|
host, rpcPort, trackingUrl));
|
|
|
|
|
|
- testAppAttemptRunningState(container, host, rpcPort, trackingUrl);
|
|
|
+ testAppAttemptRunningState(container, host, rpcPort, trackingUrl,
|
|
|
+ unmanagedAM);
|
|
|
}
|
|
|
|
|
|
private void unregisterApplicationAttempt(Container container,
|
|
@@ -567,7 +576,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
applicationAttempt.getAppAttemptId());
|
|
|
|
|
|
// launch AM
|
|
|
- runApplicationAttempt(null, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(null, "host", 8042, "oldtrackingurl", true);
|
|
|
|
|
|
// complete a container
|
|
|
applicationAttempt.handle(new RMAppAttemptContainerAcquiredEvent(
|
|
@@ -581,7 +590,8 @@ public class TestRMAppAttemptTransitions {
|
|
|
applicationAttempt.handle(new RMAppAttemptUnregistrationEvent(
|
|
|
applicationAttempt.getAppAttemptId(), trackingUrl, finalStatus,
|
|
|
diagnostics));
|
|
|
- testAppAttemptFinishedState(null, finalStatus, trackingUrl, diagnostics, 1);
|
|
|
+ testAppAttemptFinishedState(null, finalStatus, trackingUrl, diagnostics, 1,
|
|
|
+ true);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -690,7 +700,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testRunningToFailed() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
String containerDiagMsg = "some error";
|
|
|
int exitCode = 123;
|
|
|
ContainerStatus cs = BuilderUtils.newContainerStatus(amContainer.getId(),
|
|
@@ -713,7 +723,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testRunningToKilled() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
applicationAttempt.handle(
|
|
|
new RMAppAttemptEvent(
|
|
|
applicationAttempt.getAppAttemptId(),
|
|
@@ -751,7 +761,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testRunningExpire() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
applicationAttempt.handle(new RMAppAttemptEvent(
|
|
|
applicationAttempt.getAppAttemptId(), RMAppAttemptEventType.EXPIRE));
|
|
|
assertEquals(RMAppAttemptState.FAILED,
|
|
@@ -769,7 +779,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testUnregisterToKilledFinishing() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
unregisterApplicationAttempt(amContainer,
|
|
|
FinalApplicationStatus.KILLED, "newtrackingurl",
|
|
|
"Killed by user");
|
|
@@ -780,14 +790,14 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testNoTrackingUrl() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "", false);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testUnregisterToSuccessfulFinishing() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
unregisterApplicationAttempt(amContainer,
|
|
|
FinalApplicationStatus.SUCCEEDED, "mytrackingurl", "Successful");
|
|
|
}
|
|
@@ -796,7 +806,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testFinishingKill() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
FinalApplicationStatus finalStatus = FinalApplicationStatus.FAILED;
|
|
|
String trackingUrl = "newtrackingurl";
|
|
|
String diagnostics = "Job failed";
|
|
@@ -814,7 +824,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testFinishingExpire() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
FinalApplicationStatus finalStatus = FinalApplicationStatus.SUCCEEDED;
|
|
|
String trackingUrl = "mytrackingurl";
|
|
|
String diagnostics = "Successful";
|
|
@@ -825,14 +835,14 @@ public class TestRMAppAttemptTransitions {
|
|
|
applicationAttempt.getAppAttemptId(),
|
|
|
RMAppAttemptEventType.EXPIRE));
|
|
|
testAppAttemptFinishedState(amContainer, finalStatus, trackingUrl,
|
|
|
- diagnostics, 0);
|
|
|
+ diagnostics, 0, false);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void testFinishingToFinishing() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
FinalApplicationStatus finalStatus = FinalApplicationStatus.SUCCEEDED;
|
|
|
String trackingUrl = "mytrackingurl";
|
|
|
String diagnostics = "Successful";
|
|
@@ -854,7 +864,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
public void testSuccessfulFinishingToFinished() {
|
|
|
Container amContainer = allocateApplicationAttempt();
|
|
|
launchApplicationAttempt(amContainer);
|
|
|
- runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl");
|
|
|
+ runApplicationAttempt(amContainer, "host", 8042, "oldtrackingurl", false);
|
|
|
FinalApplicationStatus finalStatus = FinalApplicationStatus.SUCCEEDED;
|
|
|
String trackingUrl = "mytrackingurl";
|
|
|
String diagnostics = "Successful";
|
|
@@ -866,7 +876,7 @@ public class TestRMAppAttemptTransitions {
|
|
|
BuilderUtils.newContainerStatus(amContainer.getId(),
|
|
|
ContainerState.COMPLETE, "", 0)));
|
|
|
testAppAttemptFinishedState(amContainer, finalStatus, trackingUrl,
|
|
|
- diagnostics, 0);
|
|
|
+ diagnostics, 0, false);
|
|
|
}
|
|
|
|
|
|
private void verifyTokenCount(ApplicationAttemptId appAttemptId, int count) {
|