YARN-6832. Tests use assertTrue(....equals(...)) instead of assertEquals()). (Daniel Templeton via Yufei Gu)
This commit is contained in:
parent
3ef7adc748
commit
ce609d06c0
|
@ -489,9 +489,8 @@ public class TestYarnClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
reports = client.getApplications(appTypes, appStates);
|
reports = client.getApplications(appTypes, appStates);
|
||||||
Assert.assertEquals(reports.size(), 1);
|
Assert.assertEquals(1, reports.size());
|
||||||
Assert
|
Assert.assertEquals("NON-YARN", reports.get(0).getApplicationType());
|
||||||
.assertTrue((reports.get(0).getApplicationType().equals("NON-YARN")));
|
|
||||||
for (ApplicationReport report : reports) {
|
for (ApplicationReport report : reports) {
|
||||||
Assert.assertTrue(expectedReports.contains(report));
|
Assert.assertTrue(expectedReports.contains(report));
|
||||||
}
|
}
|
||||||
|
@ -1501,8 +1500,8 @@ public class TestYarnClient {
|
||||||
ReservationRequests reservationRequests =
|
ReservationRequests reservationRequests =
|
||||||
response.getReservationAllocationState().get(0)
|
response.getReservationAllocationState().get(0)
|
||||||
.getReservationDefinition().getReservationRequests();
|
.getReservationDefinition().getReservationRequests();
|
||||||
Assert.assertTrue(
|
Assert.assertEquals("R_ALL",
|
||||||
reservationRequests.getInterpreter().toString().equals("R_ALL"));
|
reservationRequests.getInterpreter().toString());
|
||||||
Assert.assertTrue(reservationRequests.getReservationResources().get(0)
|
Assert.assertTrue(reservationRequests.getReservationResources().get(0)
|
||||||
.getDuration() == duration);
|
.getDuration() == duration);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class TestProcfsBasedProcessTree {
|
||||||
"vmem (old API) for the gone-process is " + p.getCumulativeVmem()
|
"vmem (old API) for the gone-process is " + p.getCumulativeVmem()
|
||||||
+ " . It should be UNAVAILABLE(-1).",
|
+ " . It should be UNAVAILABLE(-1).",
|
||||||
p.getCumulativeVmem() == UNAVAILABLE);
|
p.getCumulativeVmem() == UNAVAILABLE);
|
||||||
Assert.assertTrue(p.toString().equals("[ ]"));
|
Assert.assertEquals("[ ]", p.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProcfsBasedProcessTree createProcessTree(String pid) {
|
protected ProcfsBasedProcessTree createProcessTree(String pid) {
|
||||||
|
|
|
@ -20,9 +20,9 @@ package org.apache.hadoop.yarn.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
/**
|
/**
|
||||||
* A JUnit test to test {@link YarnVersionInfo}
|
* 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
|
// can't easily know what the correct values are going to be so just
|
||||||
// make sure they aren't Unknown
|
// make sure they aren't Unknown
|
||||||
assertTrue("getVersion returned Unknown", !YarnVersionInfo.getVersion().equals("Unknown"));
|
assertNotEquals("getVersion returned Unknown",
|
||||||
assertTrue("getUser returned Unknown", !YarnVersionInfo.getUser().equals("Unknown"));
|
"Unknown", YarnVersionInfo.getVersion());
|
||||||
assertTrue("getSrcChecksum returned Unknown", !YarnVersionInfo.getSrcChecksum().equals("Unknown"));
|
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
|
// these could be Unknown if the VersionInfo generated from code not in svn or git
|
||||||
// so just check that they return something
|
// so just check that they return something
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class TestAuxServices {
|
||||||
defaultAuxClassPath = new HashSet<String>(Arrays.asList(StringUtils
|
defaultAuxClassPath = new HashSet<String>(Arrays.asList(StringUtils
|
||||||
.getTrimmedStrings(auxClassPath)));
|
.getTrimmedStrings(auxClassPath)));
|
||||||
}
|
}
|
||||||
Assert.assertTrue(auxName.equals("ServiceC"));
|
Assert.assertEquals("ServiceC", auxName);
|
||||||
aux.serviceStop();
|
aux.serviceStop();
|
||||||
|
|
||||||
// create a new jar file, and configure it as customized class path
|
// create a new jar file, and configure it as customized class path
|
||||||
|
|
|
@ -573,4 +573,4 @@ public class TestCGroupsHandlerImpl {
|
||||||
new File(new File(newMountPoint, "cpu"), this.hierarchy);
|
new File(new File(newMountPoint, "cpu"), this.hierarchy);
|
||||||
assertTrue("Yarn cgroup should exist", hierarchyFile.exists());
|
assertTrue("Yarn cgroup should exist", hierarchyFile.exists());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1344,8 +1344,8 @@ public class TestClientRMService {
|
||||||
ReservationRequests reservationRequests =
|
ReservationRequests reservationRequests =
|
||||||
response.getReservationAllocationState().get(0)
|
response.getReservationAllocationState().get(0)
|
||||||
.getReservationDefinition().getReservationRequests();
|
.getReservationDefinition().getReservationRequests();
|
||||||
Assert.assertTrue(
|
Assert.assertEquals("R_ALL",
|
||||||
reservationRequests.getInterpreter().toString().equals("R_ALL"));
|
reservationRequests.getInterpreter().toString());
|
||||||
Assert.assertTrue(reservationRequests.getReservationResources().get(0)
|
Assert.assertTrue(reservationRequests.getReservationResources().get(0)
|
||||||
.getDuration() == duration);
|
.getDuration() == duration);
|
||||||
|
|
||||||
|
|
|
@ -119,9 +119,8 @@ public class TestReservationInputValidator {
|
||||||
} catch (YarnException e) {
|
} catch (YarnException e) {
|
||||||
Assert.assertNull(plan);
|
Assert.assertNull(plan);
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
Assert
|
Assert.assertEquals("The queue is not specified. Please try again with a "
|
||||||
.assertTrue(message
|
+ "valid reservable queue.", message);
|
||||||
.equals("The queue is not specified. Please try again with a valid reservable queue."));
|
|
||||||
LOG.info(message);
|
LOG.info(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,9 +160,8 @@ public class TestReservationInputValidator {
|
||||||
} catch (YarnException e) {
|
} catch (YarnException e) {
|
||||||
Assert.assertNull(plan);
|
Assert.assertNull(plan);
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
Assert
|
Assert.assertEquals("Missing reservation definition. Please try again by "
|
||||||
.assertTrue(message
|
+ "specifying a reservation definition.", message);
|
||||||
.equals("Missing reservation definition. Please try again by specifying a reservation definition."));
|
|
||||||
LOG.info(message);
|
LOG.info(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -760,12 +760,12 @@ public class TestSchedulerUtils {
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler, rmContext);
|
scheduler, rmContext);
|
||||||
Assert.assertTrue(resReq.getNodeLabelExpression().equals("x"));
|
Assert.assertEquals("x", resReq.getNodeLabelExpression());
|
||||||
|
|
||||||
resReq.setNodeLabelExpression(" y ");
|
resReq.setNodeLabelExpression(" y ");
|
||||||
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler, rmContext);
|
scheduler, rmContext);
|
||||||
Assert.assertTrue(resReq.getNodeLabelExpression().equals("y"));
|
Assert.assertEquals("y", resReq.getNodeLabelExpression());
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
fail("Should be valid when request labels is a subset of queue labels");
|
fail("Should be valid when request labels is a subset of queue labels");
|
||||||
|
|
|
@ -1527,7 +1527,7 @@ public class TestCapacityScheduler {
|
||||||
String queue =
|
String queue =
|
||||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("a1"));
|
Assert.assertEquals("a1", queue);
|
||||||
|
|
||||||
List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
||||||
assertTrue(appsInA.contains(appAttemptId));
|
assertTrue(appsInA.contains(appAttemptId));
|
||||||
|
@ -1552,7 +1552,7 @@ public class TestCapacityScheduler {
|
||||||
queue =
|
queue =
|
||||||
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("b1"));
|
Assert.assertEquals("b1", queue);
|
||||||
|
|
||||||
appsInB = scheduler.getAppsInQueue("b");
|
appsInB = scheduler.getAppsInQueue("b");
|
||||||
assertTrue(appsInB.contains(appAttemptId));
|
assertTrue(appsInB.contains(appAttemptId));
|
||||||
|
@ -1589,7 +1589,7 @@ public class TestCapacityScheduler {
|
||||||
String queue =
|
String queue =
|
||||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("a1"));
|
Assert.assertEquals("a1", queue);
|
||||||
|
|
||||||
List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
||||||
assertTrue(appsInA.contains(appAttemptId));
|
assertTrue(appsInA.contains(appAttemptId));
|
||||||
|
@ -1611,7 +1611,7 @@ public class TestCapacityScheduler {
|
||||||
queue =
|
queue =
|
||||||
scheduler.getApplicationAttempt(appsInA2.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInA2.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("a2"));
|
Assert.assertEquals("a2", queue);
|
||||||
|
|
||||||
appsInA1 = scheduler.getAppsInQueue("a1");
|
appsInA1 = scheduler.getAppsInQueue("a1");
|
||||||
assertTrue(appsInA1.isEmpty());
|
assertTrue(appsInA1.isEmpty());
|
||||||
|
@ -2109,7 +2109,7 @@ public class TestCapacityScheduler {
|
||||||
String queue =
|
String queue =
|
||||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("a1"));
|
Assert.assertEquals("a1", queue);
|
||||||
|
|
||||||
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
||||||
assertTrue(appsInRoot.contains(appAttemptId));
|
assertTrue(appsInRoot.contains(appAttemptId));
|
||||||
|
@ -2131,7 +2131,7 @@ public class TestCapacityScheduler {
|
||||||
queue =
|
queue =
|
||||||
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("b1"));
|
Assert.assertEquals("b1", queue);
|
||||||
|
|
||||||
appsInB = scheduler.getAppsInQueue("b");
|
appsInB = scheduler.getAppsInQueue("b");
|
||||||
assertTrue(appsInB.contains(appAttemptId));
|
assertTrue(appsInB.contains(appAttemptId));
|
||||||
|
@ -2487,7 +2487,7 @@ public class TestCapacityScheduler {
|
||||||
String queue =
|
String queue =
|
||||||
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("a1"));
|
Assert.assertEquals("a1", queue);
|
||||||
|
|
||||||
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
||||||
assertTrue(appsInRoot.contains(appAttemptId));
|
assertTrue(appsInRoot.contains(appAttemptId));
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class TestCapacitySchedulerDynamicBehavior {
|
||||||
String queue =
|
String queue =
|
||||||
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
||||||
.getQueueName();
|
.getQueueName();
|
||||||
Assert.assertTrue(queue.equals("b1"));
|
Assert.assertEquals("b1", queue);
|
||||||
|
|
||||||
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
||||||
assertTrue(appsInRoot.contains(appAttemptId));
|
assertTrue(appsInRoot.contains(appAttemptId));
|
||||||
|
|
|
@ -41,8 +41,8 @@ import org.junit.Test;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used TestRMWebServices as an example of web invocations of RM and added
|
* Used TestRMWebServices as an example of web invocations of RM and added
|
||||||
|
@ -87,9 +87,9 @@ public class TestRMWithXFSFilter extends JerseyTestBase {
|
||||||
ClientResponse response = r.path("ws").path("v1").path("cluster")
|
ClientResponse response = r.path("ws").path("v1").path("cluster")
|
||||||
.path("info").accept("application/xml")
|
.path("info").accept("application/xml")
|
||||||
.get(ClientResponse.class);
|
.get(ClientResponse.class);
|
||||||
assertTrue("Should have received DENY x-frame options header",
|
assertEquals("Should have received DENY x-frame options header",
|
||||||
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0)
|
"DENY",
|
||||||
.equals("DENY"));
|
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createInjector(String headerValue) {
|
protected void createInjector(String headerValue) {
|
||||||
|
@ -138,9 +138,9 @@ public class TestRMWithXFSFilter extends JerseyTestBase {
|
||||||
ClientResponse response = r.path("ws").path("v1").path("cluster")
|
ClientResponse response = r.path("ws").path("v1").path("cluster")
|
||||||
.path("info").accept("application/xml")
|
.path("info").accept("application/xml")
|
||||||
.get(ClientResponse.class);
|
.get(ClientResponse.class);
|
||||||
assertTrue("Should have received SAMEORIGIN x-frame options header",
|
assertEquals("Should have received SAMEORIGIN x-frame options header",
|
||||||
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0)
|
"SAMEORIGIN",
|
||||||
.equals("SAMEORIGIN"));
|
response.getHeaders().get(XFrameOptionsFilter.X_FRAME_OPTIONS).get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue