YARN-6832. Tests use assertTrue(....equals(...)) instead of assertEquals()). (Daniel Templeton via Yufei Gu)
This commit is contained in:
parent
293c74a81b
commit
c617fe02b3
|
@ -489,9 +489,8 @@ public class TestYarnClient {
|
|||
}
|
||||
|
||||
reports = client.getApplications(appTypes, appStates);
|
||||
Assert.assertEquals(reports.size(), 1);
|
||||
Assert
|
||||
.assertTrue((reports.get(0).getApplicationType().equals("NON-YARN")));
|
||||
Assert.assertEquals(1, reports.size());
|
||||
Assert.assertEquals("NON-YARN", reports.get(0).getApplicationType());
|
||||
for (ApplicationReport report : reports) {
|
||||
Assert.assertTrue(expectedReports.contains(report));
|
||||
}
|
||||
|
@ -1501,8 +1500,8 @@ public class TestYarnClient {
|
|||
ReservationRequests reservationRequests =
|
||||
response.getReservationAllocationState().get(0)
|
||||
.getReservationDefinition().getReservationRequests();
|
||||
Assert.assertTrue(
|
||||
reservationRequests.getInterpreter().toString().equals("R_ALL"));
|
||||
Assert.assertEquals("R_ALL",
|
||||
reservationRequests.getInterpreter().toString());
|
||||
Assert.assertTrue(reservationRequests.getReservationResources().get(0)
|
||||
.getDuration() == duration);
|
||||
} finally {
|
||||
|
|
|
@ -236,7 +236,7 @@ public class TestProcfsBasedProcessTree {
|
|||
"vmem for the gone-process is " + p.getVirtualMemorySize()
|
||||
+ " . It should be UNAVAILABLE(-1).",
|
||||
p.getVirtualMemorySize() == UNAVAILABLE);
|
||||
Assert.assertTrue(p.toString().equals("[ ]"));
|
||||
Assert.assertEquals("[ ]", p.toString());
|
||||
}
|
||||
|
||||
protected ProcfsBasedProcessTree createProcessTree(String pid) {
|
||||
|
|
|
@ -20,9 +20,9 @@ package org.apache.hadoop.yarn.util;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
/**
|
||||
* A JUnit test to test {@link YarnVersionInfo}
|
||||
|
@ -38,9 +38,12 @@ public class TestYarnVersionInfo {
|
|||
|
||||
// can't easily know what the correct values are going to be so just
|
||||
// make sure they aren't Unknown
|
||||
assertTrue("getVersion returned Unknown", !YarnVersionInfo.getVersion().equals("Unknown"));
|
||||
assertTrue("getUser returned Unknown", !YarnVersionInfo.getUser().equals("Unknown"));
|
||||
assertTrue("getSrcChecksum returned Unknown", !YarnVersionInfo.getSrcChecksum().equals("Unknown"));
|
||||
assertNotEquals("getVersion returned Unknown",
|
||||
"Unknown", YarnVersionInfo.getVersion());
|
||||
assertNotEquals("getUser returned Unknown",
|
||||
"Unknown", YarnVersionInfo.getUser());
|
||||
assertNotEquals("getSrcChecksum returned Unknown",
|
||||
"Unknown", YarnVersionInfo.getSrcChecksum());
|
||||
|
||||
// these could be Unknown if the VersionInfo generated from code not in svn or git
|
||||
// so just check that they return something
|
||||
|
|
|
@ -210,7 +210,7 @@ public class TestAuxServices {
|
|||
defaultAuxClassPath = new HashSet<String>(Arrays.asList(StringUtils
|
||||
.getTrimmedStrings(auxClassPath)));
|
||||
}
|
||||
Assert.assertTrue(auxName.equals("ServiceC"));
|
||||
Assert.assertEquals("ServiceC", auxName);
|
||||
aux.serviceStop();
|
||||
|
||||
// create a new jar file, and configure it as customized class path
|
||||
|
|
|
@ -1612,8 +1612,8 @@ public class TestClientRMService {
|
|||
ReservationRequests reservationRequests =
|
||||
response.getReservationAllocationState().get(0)
|
||||
.getReservationDefinition().getReservationRequests();
|
||||
Assert.assertTrue(
|
||||
reservationRequests.getInterpreter().toString().equals("R_ALL"));
|
||||
Assert.assertEquals("R_ALL",
|
||||
reservationRequests.getInterpreter().toString());
|
||||
Assert.assertTrue(reservationRequests.getReservationResources().get(0)
|
||||
.getDuration() == duration);
|
||||
|
||||
|
|
|
@ -119,9 +119,8 @@ public class TestReservationInputValidator {
|
|||
} catch (YarnException e) {
|
||||
Assert.assertNull(plan);
|
||||
String message = e.getMessage();
|
||||
Assert
|
||||
.assertTrue(message
|
||||
.equals("The queue is not specified. Please try again with a valid reservable queue."));
|
||||
Assert.assertEquals("The queue is not specified. Please try again with a "
|
||||
+ "valid reservable queue.", message);
|
||||
LOG.info(message);
|
||||
}
|
||||
}
|
||||
|
@ -161,9 +160,8 @@ public class TestReservationInputValidator {
|
|||
} catch (YarnException e) {
|
||||
Assert.assertNull(plan);
|
||||
String message = e.getMessage();
|
||||
Assert
|
||||
.assertTrue(message
|
||||
.equals("Missing reservation definition. Please try again by specifying a reservation definition."));
|
||||
Assert.assertEquals("Missing reservation definition. Please try again by "
|
||||
+ "specifying a reservation definition.", message);
|
||||
LOG.info(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -760,12 +760,12 @@ public class TestSchedulerUtils {
|
|||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||
scheduler, rmContext);
|
||||
Assert.assertTrue(resReq.getNodeLabelExpression().equals("x"));
|
||||
Assert.assertEquals("x", resReq.getNodeLabelExpression());
|
||||
|
||||
resReq.setNodeLabelExpression(" y ");
|
||||
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||
scheduler, rmContext);
|
||||
Assert.assertTrue(resReq.getNodeLabelExpression().equals("y"));
|
||||
Assert.assertEquals("y", resReq.getNodeLabelExpression());
|
||||
} catch (InvalidResourceRequestException e) {
|
||||
e.printStackTrace();
|
||||
fail("Should be valid when request labels is a subset of queue labels");
|
||||
|
|
|
@ -1529,7 +1529,7 @@ public class TestCapacityScheduler {
|
|||
String queue =
|
||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("a1"));
|
||||
Assert.assertEquals("a1", queue);
|
||||
|
||||
List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
||||
assertTrue(appsInA.contains(appAttemptId));
|
||||
|
@ -1554,7 +1554,7 @@ public class TestCapacityScheduler {
|
|||
queue =
|
||||
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("b1"));
|
||||
Assert.assertEquals("b1", queue);
|
||||
|
||||
appsInB = scheduler.getAppsInQueue("b");
|
||||
assertTrue(appsInB.contains(appAttemptId));
|
||||
|
@ -1591,7 +1591,7 @@ public class TestCapacityScheduler {
|
|||
String queue =
|
||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("a1"));
|
||||
Assert.assertEquals("a1", queue);
|
||||
|
||||
List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
||||
assertTrue(appsInA.contains(appAttemptId));
|
||||
|
@ -1613,7 +1613,7 @@ public class TestCapacityScheduler {
|
|||
queue =
|
||||
scheduler.getApplicationAttempt(appsInA2.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("a2"));
|
||||
Assert.assertEquals("a2", queue);
|
||||
|
||||
appsInA1 = scheduler.getAppsInQueue("a1");
|
||||
assertTrue(appsInA1.isEmpty());
|
||||
|
@ -2111,7 +2111,7 @@ public class TestCapacityScheduler {
|
|||
String queue =
|
||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("a1"));
|
||||
Assert.assertEquals("a1", queue);
|
||||
|
||||
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
||||
assertTrue(appsInRoot.contains(appAttemptId));
|
||||
|
@ -2133,7 +2133,7 @@ public class TestCapacityScheduler {
|
|||
queue =
|
||||
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("b1"));
|
||||
Assert.assertEquals("b1", queue);
|
||||
|
||||
appsInB = scheduler.getAppsInQueue("b");
|
||||
assertTrue(appsInB.contains(appAttemptId));
|
||||
|
@ -2489,7 +2489,7 @@ public class TestCapacityScheduler {
|
|||
String queue =
|
||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("a1"));
|
||||
Assert.assertEquals("a1", queue);
|
||||
|
||||
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
||||
assertTrue(appsInRoot.contains(appAttemptId));
|
||||
|
|
|
@ -222,7 +222,7 @@ public class TestCapacitySchedulerDynamicBehavior {
|
|||
String queue =
|
||||
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
||||
.getQueueName();
|
||||
Assert.assertTrue(queue.equals("b1"));
|
||||
Assert.assertEquals("b1", queue);
|
||||
|
||||
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
||||
assertTrue(appsInRoot.contains(appAttemptId));
|
||||
|
|
|
@ -39,8 +39,8 @@ import org.junit.Test;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Used TestRMWebServices as an example of web invocations of RM and added
|
||||
|
@ -72,9 +72,9 @@ public class TestRMWithXFSFilter extends JerseyTestBase {
|
|||
ClientResponse response = r.path("ws").path("v1").path("cluster")
|
||||
.path("info").accept("application/xml")
|
||||
.get(ClientResponse.class);
|
||||
assertTrue("Should have received DENY x-frame options header",
|
||||
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0)
|
||||
.equals("DENY"));
|
||||
assertEquals("Should have received DENY x-frame options header",
|
||||
"DENY",
|
||||
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0));
|
||||
}
|
||||
|
||||
protected void createInjector(String headerValue) {
|
||||
|
@ -123,9 +123,9 @@ public class TestRMWithXFSFilter extends JerseyTestBase {
|
|||
ClientResponse response = r.path("ws").path("v1").path("cluster")
|
||||
.path("info").accept("application/xml")
|
||||
.get(ClientResponse.class);
|
||||
assertTrue("Should have received SAMEORIGIN x-frame options header",
|
||||
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0)
|
||||
.equals("SAMEORIGIN"));
|
||||
assertEquals("Should have received SAMEORIGIN x-frame options header",
|
||||
"SAMEORIGIN",
|
||||
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1325,7 +1325,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
int cfgCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
cfgCnt += entity.getConfigs().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
assertEquals(0, cfgCnt);
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
cfgCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
cfgCnt += entity.getConfigs().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
assertEquals(3, cfgCnt);
|
||||
|
||||
|
@ -1360,7 +1360,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
cfgCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
cfgCnt += entity.getConfigs().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
for (String configKey : entity.getConfigs().keySet()) {
|
||||
assertTrue(configKey.startsWith("cfg_") ||
|
||||
configKey.startsWith("configuration_"));
|
||||
|
@ -1393,7 +1393,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
assertNotNull(entities);
|
||||
assertEquals(1, entities.size());
|
||||
for (TimelineEntity entity : entities) {
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
} finally {
|
||||
client.destroy();
|
||||
|
@ -1457,7 +1457,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
int infoCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
infoCnt += entity.getInfo().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
// Includes UID in info field even if fields not specified as INFO.
|
||||
assertEquals(1, infoCnt);
|
||||
|
@ -1476,7 +1476,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
infoCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
infoCnt += entity.getInfo().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
// Includes UID in info field.
|
||||
assertEquals(4, infoCnt);
|
||||
|
@ -1506,7 +1506,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
assertNotNull(entities);
|
||||
assertEquals(1, entities.size());
|
||||
for (TimelineEntity entity : entities) {
|
||||
assertTrue(entity.getId().equals("entity1"));
|
||||
assertEquals("entity1", entity.getId());
|
||||
}
|
||||
} finally {
|
||||
client.destroy();
|
||||
|
@ -1556,7 +1556,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
int metricCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
metricCnt += entity.getMetrics().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
assertEquals(0, metricCnt);
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
metricCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
metricCnt += entity.getMetrics().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
assertEquals(3, metricCnt);
|
||||
|
||||
|
@ -1593,7 +1593,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
metricCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
metricCnt += entity.getMetrics().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
for (TimelineMetric metric : entity.getMetrics()) {
|
||||
assertTrue(metric.getId().startsWith("MAP1"));
|
||||
assertEquals(TimelineMetric.Type.SINGLE_VALUE, metric.getType());
|
||||
|
@ -1614,7 +1614,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
metricCnt = 0;
|
||||
for (TimelineEntity entity : entities) {
|
||||
metricCnt += entity.getMetrics().size();
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
for (TimelineMetric metric : entity.getMetrics()) {
|
||||
assertTrue(metric.getId().startsWith("MAP1"));
|
||||
if (metric.getId().equals("MAP1_SLOT_MILLIS")) {
|
||||
|
@ -1654,7 +1654,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
assertNotNull(entities);
|
||||
assertEquals(1, entities.size());
|
||||
for (TimelineEntity entity : entities) {
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
} finally {
|
||||
client.destroy();
|
||||
|
@ -1695,7 +1695,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
assertNotNull(entities);
|
||||
assertEquals(1, entities.size());
|
||||
for (TimelineEntity entity : entities) {
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
|
||||
// eventfilters=(!(event1,event3) OR event5,event6) OR
|
||||
|
@ -1753,7 +1753,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
assertNotNull(entities);
|
||||
assertEquals(1, entities.size());
|
||||
for (TimelineEntity entity : entities) {
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
|
||||
// isrelatedto=(!(type3:entity31,type2:entity21:entity22)OR type5:
|
||||
|
@ -1785,7 +1785,7 @@ public class TestTimelineReaderWebServicesHBaseStorage {
|
|||
assertNotNull(entities);
|
||||
assertEquals(1, entities.size());
|
||||
for (TimelineEntity entity : entities) {
|
||||
assertTrue(entity.getId().equals("entity2"));
|
||||
assertEquals("entity2", entity.getId());
|
||||
}
|
||||
|
||||
// relatesto=(!(type3:entity31,type2:entity21:entity22)OR type5:entity51,
|
||||
|
|
Loading…
Reference in New Issue