diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 25e7c2343336e..35d71e583b0a5 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -186,7 +186,7 @@ --enable-native-access=ALL-UNNAMED - -Xmx4096m -Xss2m -XX:+HeapDumpOnOutOfMemoryError ${extraJavaTestArgs} + -Xmx4096m -Xss4m -XX:+HeapDumpOnOutOfMemoryError ${extraJavaTestArgs} 3.5.3 ${maven-surefire-plugin.version} ${maven-surefire-plugin.version} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml index 87cb6a7630b98..ae5311bfefed6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml @@ -80,11 +80,6 @@ - - junit - junit - test - org.junit.jupiter junit-jupiter-api @@ -95,11 +90,6 @@ junit-jupiter-engine test - - org.junit.vintage - junit-vintage-engine - test - org.junit.platform diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/pom.xml index 493f89d1350dc..83a2c6dae74c9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/pom.xml @@ -39,12 +39,6 @@ provided - - junit - junit - test - - ch.qos.reload4j reload4j @@ -182,11 +176,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellBaseTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellBaseTest.java index fd9e2db61119f..607a4c90d7e93 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellBaseTest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellBaseTest.java @@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; +import org.apache.hadoop.security.UserGroupInformation; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; @@ -545,6 +546,20 @@ protected void setupInternal(int numNodeManagers, getTimelineVersion()); // setup the configuration of relevant for each TimelineService version. customizeConfiguration(conf); + + // To avoid data conflicts between unit tests caused by sharing the common directory + // file:/tmp/hadoop-yarn-jenkins/node-labels—such as one test reading data written by another + // and resulting in failures—we have optimized the directory logic. + // Each unit test will now generate a unique directory path based on its method name. + // For example: + // file:/tmp/hadoop-yarn-jenkins//node-labels + String nodeLabels = "file:///tmp/hadoop-yarn-" + + UserGroupInformation.getCurrentUser().getShortUserName() + + "/" + methodName + "/node-labels"; + java.nio.file.Path nodeLabelsPath = Paths.get(nodeLabels); + Files.deleteIfExists(nodeLabelsPath); + conf.set(YarnConfiguration.FS_NODE_LABELS_STORE_ROOT_DIR, nodeLabels); + // setup the yarn cluster. setUpYarnCluster(numNodeManagers, conf); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml index 5089761b46389..630966ee2266d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml @@ -32,11 +32,6 @@ - - junit - junit - test - commons-cli commons-cli diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api/pom.xml index 4d5231989eeb8..0f72b05f1ece6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-api/pom.xml @@ -186,11 +186,6 @@ hadoop-common test-jar - - junit - junit - test - org.apache.hadoop hadoop-yarn-services-core diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml index 317964557f883..e8f01239302c5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml @@ -244,12 +244,6 @@ - - junit - junit - test - - org.mockito mockito-inline @@ -289,11 +283,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml index 8e06b0f4f5265..6e7f9d243d26d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml @@ -118,11 +118,6 @@ snappy-java provided - - junit - junit - test - org.assertj assertj-core @@ -191,11 +186,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestGetGroups.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestGetGroups.java index d11ea78607c50..38f220dea8cbe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestGetGroups.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestGetGroups.java @@ -31,10 +31,10 @@ import org.apache.hadoop.util.Tool; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class TestGetGroups extends GetGroupsTestBase { private static Configuration conf; - @BeforeClass + @BeforeAll public static void setUpResourceManager() throws InterruptedException { conf = new YarnConfiguration(); resourceManager = new ResourceManager() { @@ -77,19 +77,19 @@ public void run() { }.start(); boolean rmStarted = rmStartedSignal.await(60000L, TimeUnit.MILLISECONDS); - Assert.assertTrue("ResourceManager failed to start up.", rmStarted); + Assertions.assertTrue(rmStarted, "ResourceManager failed to start up."); LOG.info("ResourceManager RMAdmin address: {}.", conf.get(YarnConfiguration.RM_ADMIN_ADDRESS)); } @SuppressWarnings("static-access") - @Before + @BeforeEach public void setUpConf() { super.conf = this.conf; } - @AfterClass + @AfterAll public static void tearDownResourceManager() throws InterruptedException { if (resourceManager != null) { LOG.info("Stopping ResourceManager..."); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java index 5091049010301..963d01b4c90ff 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java @@ -18,12 +18,12 @@ package org.apache.hadoop.yarn.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; @@ -56,10 +56,10 @@ import org.apache.hadoop.yarn.server.resourcemanager.RMFatalEventType; import org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer; import org.apache.hadoop.yarn.webapp.YarnWebParams; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.function.Supplier; import org.slf4j.Logger; @@ -81,7 +81,7 @@ public class TestRMFailover extends ClientBaseWithFixes { private MiniYARNCluster cluster; private ApplicationId fakeAppId; - @Before + @BeforeEach public void setup() throws IOException { fakeAppId = ApplicationId.newInstance(System.currentTimeMillis(), 0); conf = new YarnConfiguration(); @@ -98,7 +98,7 @@ public void setup() throws IOException { cluster = new MiniYARNCluster(TestRMFailover.class.getName(), 2, 1, 1, 1); } - @After + @AfterEach public void teardown() { cluster.stop(); } @@ -123,8 +123,8 @@ private void verifyClientConnection() { } private void verifyConnections() throws InterruptedException, YarnException { - assertTrue("NMs failed to connect to the RM", - cluster.waitForNodeManagersToConnect(20000)); + assertTrue( + cluster.waitForNodeManagersToConnect(20000), "NMs failed to connect to the RM"); verifyClientConnection(); } @@ -137,15 +137,15 @@ private void explicitFailover() throws IOException { int newActiveRMIndex = (activeRMIndex + 1) % 2; getAdminService(activeRMIndex).transitionToStandby(req); getAdminService(newActiveRMIndex).transitionToActive(req); - assertEquals("Failover failed", newActiveRMIndex, cluster.getActiveRMIndex()); + assertEquals(newActiveRMIndex, cluster.getActiveRMIndex(), "Failover failed"); } private void failover() throws IOException, InterruptedException, YarnException { int activeRMIndex = cluster.getActiveRMIndex(); cluster.stopResourceManager(activeRMIndex); - assertEquals("Failover failed", - (activeRMIndex + 1) % 2, cluster.getActiveRMIndex()); + assertEquals( + (activeRMIndex + 1) % 2, cluster.getActiveRMIndex(), "Failover failed"); cluster.restartResourceManager(activeRMIndex); } @@ -155,7 +155,7 @@ public void testExplicitFailover() conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false); cluster.init(conf); cluster.start(); - assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + assertFalse(-1 == cluster.getActiveRMIndex(), "RM never turned active"); verifyConnections(); explicitFailover(); @@ -189,7 +189,7 @@ public void testAutomaticFailover() cluster.init(conf); cluster.start(); - assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + assertFalse(-1 == cluster.getActiveRMIndex(), "RM never turned active"); verifyConnections(); failover(); @@ -220,14 +220,14 @@ public void testWebAppProxyInStandAloneMode() throws YarnException, cluster.init(conf); cluster.start(); getAdminService(0).transitionToActive(req); - assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + assertFalse(-1 == cluster.getActiveRMIndex(), "RM never turned active"); verifyConnections(); webAppProxyServer.init(conf); // Start webAppProxyServer - Assert.assertEquals(STATE.INITED, webAppProxyServer.getServiceState()); + Assertions.assertEquals(STATE.INITED, webAppProxyServer.getServiceState()); webAppProxyServer.start(); - Assert.assertEquals(STATE.STARTED, webAppProxyServer.getServiceState()); + Assertions.assertEquals(STATE.STARTED, webAppProxyServer.getServiceState()); // send httpRequest with fakeApplicationId // expect to get "Not Found" response and 404 response code @@ -253,7 +253,7 @@ public void testEmbeddedWebAppProxy() throws YarnException, conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false); cluster.init(conf); cluster.start(); - assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + assertFalse(-1 == cluster.getActiveRMIndex(), "RM never turned active"); verifyConnections(); // send httpRequest with fakeApplicationId @@ -391,7 +391,7 @@ public void testUncaughtExceptionHandlerWithHAEnabled() conf.set(YarnConfiguration.RM_ZK_ADDRESS, hostPort); cluster.init(conf); cluster.start(); - assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + assertFalse(-1 == cluster.getActiveRMIndex(), "RM never turned active"); ResourceManager resourceManager = cluster.getResourceManager( cluster.getActiveRMIndex()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml index 7c781bc6bd41a..1cfedf5493e73 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml @@ -95,11 +95,6 @@ org.apache.hadoop hadoop-annotations - - junit - junit - test - org.mockito mockito-inline diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestLRUCache.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestLRUCache.java index f3a14f1517095..decd3c5463ba1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestLRUCache.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestLRUCache.java @@ -17,8 +17,11 @@ */ package org.apache.hadoop.yarn.util; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; public class TestLRUCache { public static final int CACHE_EXPIRE_TIME = 200; @@ -29,21 +32,21 @@ public void testLRUCache() throws InterruptedException { lruCache.put("2", 1); lruCache.put("3", 3); lruCache.put("4", 4); - Assert.assertEquals(lruCache.size(), 3); - Assert.assertNull(lruCache.get("1")); - Assert.assertNotNull(lruCache.get("2")); - Assert.assertNotNull(lruCache.get("3")); - Assert.assertNotNull(lruCache.get("3")); + assertEquals(lruCache.size(), 3); + assertNull(lruCache.get("1")); + assertNotNull(lruCache.get("2")); + assertNotNull(lruCache.get("3")); + assertNotNull(lruCache.get("3")); lruCache.clear(); lruCache.put("1", 1); Thread.sleep(201); - Assert.assertEquals(lruCache.size(), 1); + assertEquals(lruCache.size(), 1); lruCache.get("1"); - Assert.assertEquals(lruCache.size(), 0); + assertEquals(lruCache.size(), 0); lruCache.put("2", 2); - Assert.assertEquals(lruCache.size(), 1); + assertEquals(lruCache.size(), 1); lruCache.put("3", 3); - Assert.assertEquals(lruCache.size(), 2); + assertEquals(lruCache.size(), 2); } } \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/JerseyTestBase.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/JerseyTestBase.java index 678af3f200507..a6ba24b6a712c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/JerseyTestBase.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/JerseyTestBase.java @@ -20,7 +20,6 @@ import org.glassfish.jersey.jettison.internal.entity.JettisonObjectProvider; import org.glassfish.jersey.test.JerseyTest; -import org.junit.Before; import org.junit.jupiter.api.BeforeEach; import javax.ws.rs.client.WebTarget; @@ -35,7 +34,6 @@ protected Application configure() { } @BeforeEach - @Before @Override public void setUp() throws Exception { super.setUp(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/pom.xml index a9fb6935872ba..cea939f62faf3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/pom.xml @@ -74,11 +74,6 @@ protobuf-java ${transient.protobuf2.scope} - - junit - junit - test - org.assertj assertj-core diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml index 7a8eccdd67278..48840df53e077 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml @@ -91,11 +91,6 @@ protobuf-java ${transient.protobuf2.scope} - - junit - junit - test - org.mockito mockito-inline @@ -195,11 +190,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - org.glassfish.jersey.media jersey-media-json-jettison diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/TestLocalityMulticastAMRMProxyPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/TestLocalityMulticastAMRMProxyPolicy.java index 778301e68f7d3..3efa6086e683a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/TestLocalityMulticastAMRMProxyPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/TestLocalityMulticastAMRMProxyPolicy.java @@ -206,7 +206,7 @@ public void testSplitBasedOnHeadroom() throws Exception { } @Test - @Timeout(value = 8) + @Timeout(value = 16) public void testStressPolicy() throws Exception { // Tests how the headroom info are used to split based on the capacity diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/scheduler/TestOpportunisticContainerContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/scheduler/TestOpportunisticContainerContext.java index c00a64eab5973..031cfceac77b1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/scheduler/TestOpportunisticContainerContext.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/scheduler/TestOpportunisticContainerContext.java @@ -21,10 +21,8 @@ import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceRequest; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Spy; import java.util.HashMap; @@ -33,6 +31,10 @@ import java.util.TreeMap; import java.util.ArrayList; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; + /** * Test cases for OpportunisticContainerContext. */ @@ -45,9 +47,9 @@ public class TestOpportunisticContainerContext { private TreeMap> outstandingOpReqs; - @Before + @BeforeEach public void setUp() { - opportunisticContainerContext = Mockito.spy(new OpportunisticContainerContext()); + opportunisticContainerContext = spy(new OpportunisticContainerContext()); outstandingOpReqs = new TreeMap<>(); } @@ -63,7 +65,7 @@ public void testAddToOutstandingReqsWithANYRequest() { List resourceRequestList = new ArrayList<>(); resourceRequestList.add(request); opportunisticContainerContext.addToOutstandingReqs(resourceRequestList); - Assert.assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); + assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); } /** @@ -76,12 +78,12 @@ public void testAddToOutstandingReqsWithANYRequest() { public void testAddToOutstandingReqsWithZeroContainer() { ResourceRequest request = getResourceRequest("resource", 0); createOutstandingOpReqs(request, getResource()); - Mockito.doReturn(outstandingOpReqs).when(opportunisticContainerContext) + doReturn(outstandingOpReqs).when(opportunisticContainerContext) .getOutstandingOpReqs(); List resourceRequestList = new ArrayList<>(); resourceRequestList.add(request); opportunisticContainerContext.addToOutstandingReqs(resourceRequestList); - Assert.assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); + assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); } /** @@ -96,13 +98,13 @@ public void testAddToOutstandingReqsWithZeroContainerAndMultipleSchedulerKey() { ResourceRequest req2 = getResourceRequest(ResourceRequest.ANY, 0); createOutstandingOpReqs(req1, getResource()); createOutstandingOpReqs(req2, getResource()); - Mockito.doReturn(outstandingOpReqs).when(opportunisticContainerContext) + doReturn(outstandingOpReqs).when(opportunisticContainerContext) .getOutstandingOpReqs(); List resourceRequestList = new ArrayList<>(); resourceRequestList.add(req1); resourceRequestList.add(req2); opportunisticContainerContext.addToOutstandingReqs(resourceRequestList); - Assert.assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); + assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); } /** @@ -117,13 +119,13 @@ public void testAddToOutstandingReqsWithMultipleSchedulerKey() { ResourceRequest req2 = getResourceRequest(ResourceRequest.ANY, 1); createOutstandingOpReqs(req1, getResource()); createOutstandingOpReqs(req2, getResource()); - Mockito.doReturn(outstandingOpReqs).when(opportunisticContainerContext) + doReturn(outstandingOpReqs).when(opportunisticContainerContext) .getOutstandingOpReqs(); List resourceRequestList = new ArrayList<>(); resourceRequestList.add(req1); resourceRequestList.add(req2); opportunisticContainerContext.addToOutstandingReqs(resourceRequestList); - Assert.assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); + assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); } /** @@ -137,12 +139,12 @@ public void testAddToOutstandingReqsWithMultipleSchedulerKey() { public void testAddToOutstandingReqsWithZeroContainerAndNullCapability() { ResourceRequest request = getResourceRequestWithoutCapability(); createOutstandingOpReqs(request, getResource()); - Mockito.doReturn(outstandingOpReqs).when(opportunisticContainerContext) + doReturn(outstandingOpReqs).when(opportunisticContainerContext) .getOutstandingOpReqs(); List resourceRequestList = new ArrayList<>(); resourceRequestList.add(request); opportunisticContainerContext.addToOutstandingReqs(resourceRequestList); - Assert.assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); + assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 1); } /** @@ -155,12 +157,12 @@ public void testAddToOutstandingReqsWithZeroContainerAndNullCapability() { @Test public void testAddToOutstandingReqsWithEmptyReqMap() { ResourceRequest request = getResourceRequest("resource", 0); - Mockito.doReturn(new TreeMap<>()).when(opportunisticContainerContext) + doReturn(new TreeMap<>()).when(opportunisticContainerContext) .getOutstandingOpReqs(); List resourceRequestList = new ArrayList<>(); resourceRequestList.add(request); opportunisticContainerContext.addToOutstandingReqs(resourceRequestList); - Assert.assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 0); + assertEquals(opportunisticContainerContext.getOutstandingOpReqs().size(), 0); } private void createOutstandingOpReqs(ResourceRequest req, Resource resource) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/pom.xml index 0a83fadacb33b..54e57acff19f0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/pom.xml @@ -72,12 +72,6 @@ hadoop-yarn-server-resourcemanager - - junit - junit - test - - org.mockito mockito-all @@ -149,12 +143,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml index c4babfd4a2d61..7a838499b85ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/pom.xml @@ -118,11 +118,6 @@ mockito-junit-jupiter test - - org.junit.vintage - junit-vintage-engine - test - org.apache.hadoop @@ -144,11 +139,6 @@ io.dropwizard.metrics metrics-core - - junit - junit - test - org.junit.jupiter junit-jupiter-params diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/pom.xml index c33a06109dff4..e4cb0335fb5cb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/pom.xml @@ -52,11 +52,6 @@ org.apache.hadoop hadoop-annotations - - junit - junit - test - org.assertj assertj-core @@ -360,11 +355,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/pom.xml index 983a913e89228..a991709934c6e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/pom.xml @@ -95,11 +95,6 @@ test - - junit - junit - test - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/TestFederationSubCluster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/TestFederationSubCluster.java index b0c4ec41cc91f..2d8ba67d30dfe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/TestFederationSubCluster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/TestFederationSubCluster.java @@ -99,7 +99,7 @@ public void startFederationSubCluster(int zkPort, String sc1Param, String connectString = curatorTestingServer.getConnectString(); curatorFramework = CuratorFrameworkFactory.builder() .connectString(connectString) - .retryPolicy(new RetryNTimes(100, 100)) + .retryPolicy(new RetryNTimes(200, 200)) .build(); curatorFramework.start(); curatorFramework.getConnectionStateListenable().addListener((client, newState) -> { @@ -202,7 +202,7 @@ private void verifyRegistration(String zkAddress) } catch (Exception e) { } return false; - }, 5000, 50 * 1000); + }, 5000, 100 * 1000); } public static T performGetCalls(final String routerAddress, final String path, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/capacity/TestYarnFederationWithCapacityScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/capacity/TestYarnFederationWithCapacityScheduler.java index 383b9ae631cfc..4eb7019b8eaf1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/capacity/TestYarnFederationWithCapacityScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/subcluster/capacity/TestYarnFederationWithCapacityScheduler.java @@ -121,10 +121,10 @@ public class TestYarnFederationWithCapacityScheduler { public static void setUp() throws IOException, InterruptedException, YarnException, TimeoutException { testFederationSubCluster = new TestFederationSubCluster(); - testFederationSubCluster.startFederationSubCluster(2181, - "18032,18030,18031,18088,18033,SC-1,127.0.0.1:2181,capacity-scheduler", - "28032,28030,28031,28088,28033,SC-2,127.0.0.1:2181,capacity-scheduler", - "18050,18052,18089,127.0.0.1:2181"); + testFederationSubCluster.startFederationSubCluster(2183, + "18032,18030,18031,18088,18033,SC-1,127.0.0.1:2183,capacity-scheduler", + "28032,28030,28031,28088,28033,SC-2,127.0.0.1:2183,capacity-scheduler", + "18050,18052,18089,127.0.0.1:2183"); subClusters = Sets.newHashSet(); subClusters.add("SC-1"); subClusters.add("SC-2"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/pom.xml index 18455a49d2c35..bbb3256481be0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/pom.xml @@ -50,11 +50,6 @@ org.apache.hadoop hadoop-annotations - - junit - junit - test - org.mockito mockito-inline diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/pom.xml index 04b3714b032f1..99c4ccc0fe318 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/pom.xml @@ -60,11 +60,6 @@ - - junit - junit - test - org.apache.hadoop hadoop-common diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/pom.xml index c6b8e94db8bbf..7cb500ef23967 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-documentstore/pom.xml @@ -57,11 +57,6 @@ - - junit - junit - test - org.mockito mockito-inline @@ -183,11 +178,6 @@ junit-platform-launcher test - - org.junit.vintage - junit-vintage-engine - test - org.mockito mockito-junit-jupiter diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/pom.xml index 506d97f1df588..c96f59f03268c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/pom.xml @@ -35,11 +35,6 @@ - - junit - junit - test -