MAPREDUCE-6914. Tests use assertTrue(....equals(...)) instead of assertEquals()). (Daniel Templeton via Yufei Gu)

This commit is contained in:
Yufei Gu 2017-08-03 11:44:34 -07:00
parent c617fe02b3
commit b8e8241854
5 changed files with 22 additions and 23 deletions

View File

@ -124,20 +124,20 @@ private void testProxyConfiguration(Configuration conf) {
proxyToUse.type() == Proxy.Type.DIRECT);
conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "somehost:1000");
setConf(conf);
Assert.assertTrue("Proxy should have been set but wasn't ",
proxyToUse.toString().equals("HTTP @ somehost:1000"));
Assert.assertEquals("Proxy should have been set but wasn't ",
"HTTP @ somehost:1000", proxyToUse.toString());
conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "socks@somehost:1000");
setConf(conf);
Assert.assertTrue("Proxy should have been socks but wasn't ",
proxyToUse.toString().equals("SOCKS @ somehost:1000"));
Assert.assertEquals("Proxy should have been socks but wasn't ",
"SOCKS @ somehost:1000", proxyToUse.toString());
conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "SOCKS@somehost:1000");
setConf(conf);
Assert.assertTrue("Proxy should have been socks but wasn't ",
proxyToUse.toString().equals("SOCKS @ somehost:1000"));
Assert.assertEquals("Proxy should have been socks but wasn't ",
"SOCKS @ somehost:1000", proxyToUse.toString());
conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "sfafn@somehost:1000");
setConf(conf);
Assert.assertTrue("Proxy should have been http but wasn't ",
proxyToUse.toString().equals("HTTP @ somehost:1000"));
Assert.assertEquals("Proxy should have been http but wasn't ",
"HTTP @ somehost:1000", proxyToUse.toString());
}

View File

@ -329,8 +329,7 @@ public void testMapNodeLocality() throws Exception {
for(TaskAttemptContainerAssignedEvent event : assigned) {
if(event.getTaskAttemptID().equals(event3.getAttemptID())) {
assigned.remove(event);
Assert.assertTrue(
event.getContainer().getNodeId().getHost().equals("h3"));
Assert.assertEquals("h3", event.getContainer().getNodeId().getHost());
break;
}
}

View File

@ -74,13 +74,13 @@ public void testQueue() throws IOException {
assertTrue(root.getChildren().size() == 2);
Iterator<Queue> iterator = root.getChildren().iterator();
Queue firstSubQueue = iterator.next();
assertTrue(firstSubQueue.getName().equals("first"));
assertEquals("first", firstSubQueue.getName());
assertEquals(
firstSubQueue.getAcls().get("mapred.queue.first.acl-submit-job")
.toString(),
"Users [user1, user2] and members of the groups [group1, group2] are allowed");
Queue secondSubQueue = iterator.next();
assertTrue(secondSubQueue.getName().equals("second"));
assertEquals("second", secondSubQueue.getName());
assertEquals(secondSubQueue.getProperties().getProperty("key"), "value");
assertEquals(secondSubQueue.getProperties().getProperty("key1"), "value1");
// test status
@ -207,13 +207,13 @@ public void test2Queue() throws IOException {
assertTrue(root.getChildren().size() == 2);
Iterator<Queue> iterator = root.getChildren().iterator();
Queue firstSubQueue = iterator.next();
assertTrue(firstSubQueue.getName().equals("first"));
assertEquals("first", firstSubQueue.getName());
assertEquals(
firstSubQueue.getAcls().get("mapred.queue.first.acl-submit-job")
.toString(),
"Users [user1, user2] and members of the groups [group1, group2] are allowed");
Queue secondSubQueue = iterator.next();
assertTrue(secondSubQueue.getName().equals("second"));
assertEquals("second", secondSubQueue.getName());
assertEquals(firstSubQueue.getState().getStateName(), "running");
assertEquals(secondSubQueue.getState().getStateName(), "stopped");

View File

@ -871,10 +871,10 @@ public void testSendJobConf() throws IOException {
Configuration confSent = BuilderUtils.parseTokensConf(submissionContext);
// configs that match regex should be included
Assert.assertTrue(confSent.get("dfs.namenode.rpc-address.mycluster2.nn1")
.equals("123.0.0.1"));
Assert.assertTrue(confSent.get("dfs.namenode.rpc-address.mycluster2.nn2")
.equals("123.0.0.2"));
Assert.assertEquals("123.0.0.1",
confSent.get("dfs.namenode.rpc-address.mycluster2.nn1"));
Assert.assertEquals("123.0.0.2",
confSent.get("dfs.namenode.rpc-address.mycluster2.nn2"));
// configs that aren't matching regex should not be included
Assert.assertTrue(confSent.get("hadoop.tmp.dir") == null || !confSent

View File

@ -134,11 +134,11 @@ public void testDoMultipleInputs() throws IOException {
BufferedReader output = new BufferedReader(new InputStreamReader(fs
.open(new Path(outDir, "part-r-00000"))));
// reducer should have counted one key from each file
assertTrue(output.readLine().equals("a 2"));
assertTrue(output.readLine().equals("b 2"));
assertTrue(output.readLine().equals("c 2"));
assertTrue(output.readLine().equals("d 2"));
assertTrue(output.readLine().equals("e 2"));
assertEquals("a 2", output.readLine());
assertEquals("b 2", output.readLine());
assertEquals("c 2", output.readLine());
assertEquals("d 2", output.readLine());
assertEquals("e 2", output.readLine());
}
@Test