MAPREDUCE-6333. TestEvents,TestAMWebServicesTasks,TestAppController are broken due to MAPREDUCE-6297. (Siqi Li via gera)

This commit is contained in:
Gera Shegalov 2015-04-24 09:21:44 -07:00
parent 2f82ae042a
commit 78c6b46241
4 changed files with 41 additions and 27 deletions

View File

@ -343,6 +343,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-6330. Fix typo in Task Attempt API's URL in documentations.
(Ryu Kobayashi via ozawa)
MAPREDUCE-6333. TestEvents,TestAMWebServicesTasks,TestAppController are
broken due to MAPREDUCE-6297. (Siqi Li via gera)
Release 2.7.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -39,6 +39,7 @@ import org.junit.Test;
public class TestEvents {
private static final String taskId = "task_1_2_r_3";
/**
* test a getters of TaskAttemptFinishedEvent and TaskAttemptFinished
*
@ -131,7 +132,7 @@ public class TestEvents {
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_KILLED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptUnsuccessfulCompletion) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
@ -141,42 +142,42 @@ public class TestEvents {
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_STARTED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptStarted) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_FINISHED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptFinished) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_KILLED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptUnsuccessfulCompletion) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_KILLED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptUnsuccessfulCompletion) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_STARTED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptStarted) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_FINISHED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptFinished) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_KILLED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptUnsuccessfulCompletion) e.getDatum()).taskid.toString());
e = reader.getNextEvent();
assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_KILLED));
assertEquals("task_1_2_r03_4",
assertEquals(taskId,
((TaskAttemptUnsuccessfulCompletion) e.getDatum()).taskid.toString());
reader.close();
@ -234,7 +235,7 @@ public class TestEvents {
datum.hostname = "hostname";
datum.rackname = "rackname";
datum.physMemKbytes = Arrays.asList(1000, 2000, 3000);
datum.taskid = "task_1_2_r03_4";
datum.taskid = taskId;
datum.port = 1000;
datum.taskType = "REDUCE";
datum.status = "STATUS";
@ -260,7 +261,7 @@ public class TestEvents {
datum.hostname = "hostname";
datum.rackname = "rackName";
datum.state = "state";
datum.taskid = "task_1_2_r03_4";
datum.taskid = taskId;
datum.taskStatus = "taskStatus";
datum.taskType = "REDUCE";
result.setDatum(datum);
@ -278,7 +279,7 @@ public class TestEvents {
datum.locality = "locality";
datum.shufflePort = 10001;
datum.startTime = 1;
datum.taskid = "task_1_2_r03_4";
datum.taskid = taskId;
datum.taskType = "taskType";
datum.trackerName = "trackerName";
result.setDatum(datum);
@ -308,7 +309,7 @@ public class TestEvents {
datum.hostname = "hostname";
datum.rackname = "rackname";
datum.state = "state";
datum.taskid = "task_1_2_r03_4";
datum.taskid = taskId;
datum.taskStatus = "taskStatus";
datum.taskType = "REDUCE";
result.setDatum(datum);
@ -325,7 +326,7 @@ public class TestEvents {
datum.locality = "locality";
datum.shufflePort = 10001;
datum.startTime = 1;
datum.taskid = "task_1_2_r03_4";
datum.taskid = taskId;
datum.taskType = "taskType";
datum.trackerName = "trackerName";
result.setDatum(datum);

View File

@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.TaskID;
import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskReport;
@ -355,9 +356,11 @@ public class TestAMWebServicesTasks extends JerseyTest {
String message = exception.getString("message");
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils.checkStringMatch("exception message",
WebServicesTestUtils.checkStringEqual("exception message",
"java.lang.Exception: TaskId string : "
+ "bogustaskid is not properly formed", message);
+ "bogustaskid is not properly formed"
+ "\nReason: java.util.regex.Matcher[pattern=" +
TaskID.TASK_ID_REGEX + " region=0,11 lastmatch=]", message);
WebServicesTestUtils.checkStringMatch("exception type",
"NotFoundException", type);
WebServicesTestUtils.checkStringMatch("exception classname",
@ -419,9 +422,11 @@ public class TestAMWebServicesTasks extends JerseyTest {
String message = exception.getString("message");
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils.checkStringMatch("exception message",
"java.lang.Exception: Bad TaskType identifier. TaskId string : "
+ "task_0_0000_d_000000 is not properly formed.", message);
WebServicesTestUtils.checkStringEqual("exception message",
"java.lang.Exception: TaskId string : "
+ "task_0_0000_d_000000 is not properly formed"
+ "\nReason: java.util.regex.Matcher[pattern=" +
TaskID.TASK_ID_REGEX + " region=0,20 lastmatch=]", message);
WebServicesTestUtils.checkStringMatch("exception type",
"NotFoundException", type);
WebServicesTestUtils.checkStringMatch("exception classname",
@ -451,9 +456,11 @@ public class TestAMWebServicesTasks extends JerseyTest {
String message = exception.getString("message");
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils.checkStringMatch("exception message",
WebServicesTestUtils.checkStringEqual("exception message",
"java.lang.Exception: TaskId string : "
+ "task_0_m_000000 is not properly formed", message);
+ "task_0_m_000000 is not properly formed"
+ "\nReason: java.util.regex.Matcher[pattern=" +
TaskID.TASK_ID_REGEX + " region=0,15 lastmatch=]", message);
WebServicesTestUtils.checkStringMatch("exception type",
"NotFoundException", type);
WebServicesTestUtils.checkStringMatch("exception classname",
@ -483,9 +490,11 @@ public class TestAMWebServicesTasks extends JerseyTest {
String message = exception.getString("message");
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils.checkStringMatch("exception message",
WebServicesTestUtils.checkStringEqual("exception message",
"java.lang.Exception: TaskId string : "
+ "task_0_0000_m is not properly formed", message);
+ "task_0_0000_m is not properly formed"
+ "\nReason: java.util.regex.Matcher[pattern=" +
TaskID.TASK_ID_REGEX + " region=0,13 lastmatch=]", message);
WebServicesTestUtils.checkStringMatch("exception type",
"NotFoundException", type);
WebServicesTestUtils.checkStringMatch("exception classname",

View File

@ -45,6 +45,7 @@ public class TestAppController {
private AppControllerForTest appController;
private RequestContext ctx;
private Job job;
private static final String taskId = "task_01_01_m_01";
@Before
public void setUp() throws IOException {
@ -70,7 +71,7 @@ public class TestAppController {
appController = new AppControllerForTest(app, configuration, ctx);
appController.getProperty().put(AMParams.JOB_ID, "job_01_01");
appController.getProperty().put(AMParams.TASK_ID, "task_01_01_m01_01");
appController.getProperty().put(AMParams.TASK_ID, taskId);
}
@ -205,7 +206,7 @@ public class TestAppController {
"Access denied: User user does not have permission to view job job_01_01missing task ID",
appController.getData());
appController.getProperty().put(AMParams.TASK_ID, "task_01_01_m01_01");
appController.getProperty().put(AMParams.TASK_ID, taskId);
appController.taskCounters();
assertEquals(CountersPage.class, appController.getClazz());
}
@ -247,7 +248,7 @@ public class TestAppController {
public void testTask() {
appController.task();
assertEquals("Attempts for task_01_01_m01_01" ,
assertEquals("Attempts for " + taskId ,
appController.getProperty().get("title"));
assertEquals(TaskPage.class, appController.getClazz());
@ -290,7 +291,7 @@ public class TestAppController {
"Access denied: User user does not have permission to view job job_01_01",
appController.getData());
appController.getProperty().put(AMParams.TASK_ID, "task_01_01_m01_01");
appController.getProperty().put(AMParams.TASK_ID, taskId);
appController.attempts();
assertEquals("Bad request: missing task-type.", appController.getProperty()
.get("title"));