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 2de2c13f16..07838688d7 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
@@ -126,6 +126,26 @@
bcprov-jdk15on
test
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ test
+
org.apache.hadoop
hadoop-auth
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java
index de944cbc89..702c5ea7df 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java
@@ -18,8 +18,6 @@
package org.apache.hadoop.yarn.server;
-import static org.junit.Assert.fail;
-
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
@@ -31,6 +29,11 @@
import java.util.concurrent.TimeoutException;
import org.apache.hadoop.conf.Configuration;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.minikdc.KerberosSecurityTestcase;
@@ -75,18 +78,15 @@
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.util.Records;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class TestContainerManagerSecurity extends KerberosSecurityTestcase {
static Logger LOG = LoggerFactory.getLogger(TestContainerManagerSecurity.class);
@@ -94,29 +94,24 @@ public class TestContainerManagerSecurity extends KerberosSecurityTestcase {
.getRecordFactory(null);
private static MiniYARNCluster yarnCluster;
private static final File testRootDir = new File("target",
- TestContainerManagerSecurity.class.getName() + "-root");
+ TestContainerManagerSecurity.class.getName() + "-root");
private static File httpSpnegoKeytabFile = new File(testRootDir,
- "httpSpnegoKeytabFile.keytab");
+ "httpSpnegoKeytabFile.keytab");
private static String httpSpnegoPrincipal = "HTTP/localhost@EXAMPLE.COM";
private Configuration conf;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ public void setup() throws Exception {
testRootDir.mkdirs();
httpSpnegoKeytabFile.deleteOnExit();
+ startMiniKdc();
getKdc().createPrincipal(httpSpnegoKeytabFile, httpSpnegoPrincipal);
- UserGroupInformation.setConfiguration(conf);
-
- yarnCluster =
- new MiniYARNCluster(TestContainerManagerSecurity.class.getName(), 1, 1,
- 1);
- yarnCluster.init(conf);
- yarnCluster.start();
}
-
- @After
+
+ @AfterEach
public void tearDown() {
+ stopMiniKdc();
if (yarnCluster != null) {
yarnCluster.stop();
yarnCluster = null;
@@ -130,48 +125,56 @@ public void tearDown() {
* and to give details in say an IDE. The second is the configuraiton
* object to use.
*/
- @Parameters(name = "{0}")
public static Collection