Skip to content

Commit

Permalink
YARN-11263. Fix CheckStyle & Junit Test.
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 committed Mar 4, 2025
1 parent 0d336b1 commit 7bd465c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public void testDiskSpaceUtilizationLimit() throws IOException {
assertEquals(1, dc.getFailedDirs().size());
assertEquals(1, dc.getFullDirs().size());
assertNotNull(dc.getDirectoryErrorInfo(dirA));
assertEquals(DirectoryCollection.DiskErrorCause.DISK_FULL, dc.getDirectoryErrorInfo(dirA).cause);
assertEquals(DirectoryCollection.DiskErrorCause.DISK_FULL,
dc.getDirectoryErrorInfo(dirA).cause);

// no good dirs
assertEquals(0, dc.getGoodDirsDiskUtilizationPercentage());
Expand Down Expand Up @@ -348,7 +349,8 @@ public void testFailedDisksBecomingGoodAgain() throws Exception {
assertEquals(1, dc.getFullDirs().size());
assertEquals(0, dc.getErroredDirs().size());
assertNotNull(dc.getDirectoryErrorInfo(dirA));
assertEquals(DirectoryCollection.DiskErrorCause.DISK_FULL, dc.getDirectoryErrorInfo(dirA).cause);
assertEquals(DirectoryCollection.DiskErrorCause.DISK_FULL,
dc.getDirectoryErrorInfo(dirA).cause);

dc.setDiskUtilizationPercentageCutoff(100.0F, 100.0F);
dc.checkDirs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ public void testContainerLaunchError()
public Object answer(InvocationOnMock invocationOnMock)
throws Throwable {
String diagnostics = (String) invocationOnMock.getArguments()[0];
assertTrue(
diagnostics.contains(expecetedMessage[j]), "Invalid Diagnostics message: " + diagnostics);
assertTrue(diagnostics.contains(expecetedMessage[j]),
"Invalid Diagnostics message: " + diagnostics);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public void testCreationOfNodeLabelsProviderService()
NodeLabelsProvider labelsProviderService =
nodeManager.createNodeLabelsProvider(conf);

assertNull(labelsProviderService,
"LabelsProviderService should not be initialized in default configuration");
assertNull(labelsProviderService,
"LabelsProviderService should not be initialized in default configuration");

// With valid className
conf.set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public void testNodeHealthService() throws Exception {
// Check proper report conditions.
assertTrue(healthStatus
.getIsNodeHealthy(), "Node health status reported unhealthy");
assertTrue(healthStatus
.getHealthReport().equals(nodeHealthChecker.getHealthReport()), "Node health status reported unhealthy");
assertTrue(healthStatus.getHealthReport().equals(nodeHealthChecker.getHealthReport()),
"Node health status reported unhealthy");

doReturn(false).when(nodeHealthScriptRunner).isHealthy();
// update health status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void registerAM(DistributedScheduler distributedScheduler,
private RequestInterceptor setup(Configuration conf,
DistributedScheduler distributedScheduler) {
NodeStatusUpdater nodeStatusUpdater = mock(NodeStatusUpdater.class);
when(nodeStatusUpdater.getRMIdentifier()).thenReturn(12345l);
when(nodeStatusUpdater.getRMIdentifier()).thenReturn(12345L);
NMContainerTokenSecretManager nmContainerTokenSecretManager = new
NMContainerTokenSecretManager(conf);
MasterKey mKey = new MasterKey() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public int getHttpPort() {
}
}

@BeforeEach
@Override
public void setUp() throws Exception {
super.setUp();
Expand Down Expand Up @@ -196,7 +197,7 @@ public void testNodeAuxServicesNone() throws Exception {
assertEquals(MediaType.APPLICATION_JSON_TYPE + ";" + JettyUtils.UTF_8,
response.getMediaType().toString());
JSONObject json = response.readEntity(JSONObject.class);
assertEquals("aux services isn't empty", "{\"services\":\"\"}", json.toString());
assertEquals("{\"services\":\"\"}", json.toString(), "aux services isn't empty");
}

private void addAuxServices(AuxServiceRecord... records) {
Expand Down

0 comments on commit 7bd465c

Please # to comment.