Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hadoop-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
--enable-native-access=ALL-UNNAMED
</extraJavaTestArgs>
<!-- Plugin versions and config -->
<maven-surefire-plugin.argLine>-Xmx4096m -Xss2m -XX:+HeapDumpOnOutOfMemoryError ${extraJavaTestArgs}</maven-surefire-plugin.argLine>
<maven-surefire-plugin.argLine>-Xmx4096m -Xss4m -XX:+HeapDumpOnOutOfMemoryError ${extraJavaTestArgs}</maven-surefire-plugin.argLine>
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
<maven-surefire-report-plugin.version>${maven-surefire-plugin.version}</maven-surefire-report-plugin.version>
<maven-failsafe-plugin.version>${maven-surefire-plugin.version}</maven-failsafe-plugin.version>
Expand Down
10 changes: 0 additions & 10 deletions hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
</exclusions>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand All @@ -95,11 +90,6 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<!-- Only required to run tests in an IDE that bundles an older version -->
<dependency>
<groupId>org.junit.platform</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
Expand Down Expand Up @@ -182,11 +176,6 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/<method-name>/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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@
<artifactId>hadoop-common</artifactId>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-services-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,6 @@
<!-- Test dependencies -->
<!-- ======================================================== -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
Expand Down Expand Up @@ -289,11 +283,6 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
10 changes: 0 additions & 10 deletions hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@
<artifactId>snappy-java</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down Expand Up @@ -191,11 +186,6 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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() {
Expand Down Expand Up @@ -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...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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();
}
Expand All @@ -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();
}

Expand All @@ -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);
}

Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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());
Expand Down
5 changes: 0 additions & 5 deletions hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-annotations</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
Expand Down
Loading