7171import org .apache .hadoop .yarn .server .resourcemanager .scheduler .capacity .CapacitySchedulerConfiguration ;
7272import org .apache .hadoop .yarn .util .resource .DominantResourceCalculator ;
7373import org .apache .hadoop .yarn .util .resource .ResourceCalculator ;
74- import org .junit .After ;
75- import org .junit .AfterClass ;
76- import org .junit .Assert ;
77- import org .junit .Assume ;
78- import org .junit .BeforeClass ;
79- import org .junit .Ignore ;
80- import org .junit .Test ;
74+ import org .junit .jupiter .api .*;
8175import org .slf4j .Logger ;
8276import org .slf4j .LoggerFactory ;
8377
8478import static org .apache .hadoop .tools .dynamometer .DynoInfraUtils .fetchHadoopTarball ;
8579import static org .apache .hadoop .hdfs .MiniDFSCluster .PROP_TEST_BUILD_DATA ;
86- import static org .hamcrest . CoreMatchers . notNullValue ;
87- import static org .junit .Assert . assertEquals ;
88- import static org .junit .Assert . assertTrue ;
89- import static org .junit .Assert . fail ;
80+ import static org .junit . jupiter . api . Assertions . assertEquals ;
81+ import static org .junit .jupiter . api . Assertions . assertTrue ;
82+ import static org .junit .jupiter . api . Assertions . fail ;
83+ import static org .junit .jupiter . api . Assumptions . assumeTrue ;
9084
9185/**
9286 * Start a Dynamometer cluster in a MiniYARNCluster. Ensure that the NameNode is
112106 * property to point directly to a Hadoop tarball which is present locally and
113107 * no download will occur.
114108 */
115- @ Ignore
109+ @ Disabled
116110public class TestDynamometerInfra {
117111
118112 private static final Logger LOG =
@@ -153,19 +147,19 @@ public class TestDynamometerInfra {
153147
154148 private ApplicationId infraAppId ;
155149
156- @ BeforeClass
150+ @ BeforeAll
157151 public static void setupClass () throws Exception {
158152 PlatformAssumptions .assumeNotWindows ("Dynamometer will not run on Windows" );
159- Assume . assumeThat ("JAVA_HOME must be set properly" ,
160- System . getenv ( "JAVA_HOME" ), notNullValue () );
153+ assumeTrue ( System . getenv ("JAVA_HOME" ) != null ,
154+ "JAVA_HOME must be set properly" );
161155 try {
162156 Shell .ShellCommandExecutor tarCheck = new Shell .ShellCommandExecutor (
163157 new String []{"bash" , "-c" , "command -v tar" });
164158 tarCheck .execute ();
165- Assume . assumeTrue ("tar command is not available" ,
166- tarCheck . getExitCode () == 0 );
159+ assumeTrue (tarCheck . getExitCode () == 0 ,
160+ "tar command is not available" );
167161 } catch (IOException ioe ) {
168- Assume . assumeNoException ( "Unable to execute a shell command" , ioe );
162+ assumeTrue ( false , "Unexpected exception occurred: " + ioe . getMessage () );
169163 }
170164
171165 conf = new Configuration ();
@@ -193,8 +187,8 @@ public static void setupClass() throws Exception {
193187 // Set up the Hadoop binary to be used as the system-level Hadoop install
194188 hadoopUnpackedDir = new File (testBaseDir ,
195189 HADOOP_BIN_UNPACKED_DIR_PREFIX + UUID .randomUUID ());
196- assertTrue ("Failed to make temporary directory" ,
197- hadoopUnpackedDir .mkdirs ());
190+ assertTrue (
191+ hadoopUnpackedDir .mkdirs (), "Failed to make temporary directory" );
198192 Shell .ShellCommandExecutor shexec = new Shell .ShellCommandExecutor (
199193 new String [] {"tar" , "xzf" , hadoopTarballPath .getAbsolutePath (), "-C" ,
200194 hadoopUnpackedDir .getAbsolutePath ()});
@@ -280,7 +274,7 @@ public static void setupClass() throws Exception {
280274 nodeLabelManager .addLabelsToNode (nodeLabels );
281275 }
282276
283- @ AfterClass
277+ @ AfterAll
284278 public static void teardownClass () throws Exception {
285279 if (miniDFSCluster != null ) {
286280 miniDFSCluster .shutdown (true );
@@ -303,15 +297,16 @@ public static void teardownClass() throws Exception {
303297 }
304298 }
305299
306- @ After
300+ @ AfterEach
307301 public void tearDown () throws Exception {
308302 if (infraAppId != null && yarnClient != null ) {
309303 yarnClient .killApplication (infraAppId );
310304 }
311305 infraAppId = null ;
312306 }
313307
314- @ Test (timeout = 15 * 60 * 1000 )
308+ @ Test
309+ @ Timeout (15 * 60 )
315310 public void testNameNodeInYARN () throws Exception {
316311 Configuration localConf = new Configuration (yarnConf );
317312 localConf .setLong (AuditLogDirectParser .AUDIT_START_TIMESTAMP_KEY , 60000 );
@@ -458,7 +453,7 @@ private void awaitApplicationStartup()
458453
459454 private Client createAndStartClient (Configuration localConf ) {
460455 final Client client = new Client (JarFinder .getJar (ApplicationMaster .class ),
461- JarFinder .getJar (Assert .class ));
456+ JarFinder .getJar (Assertions .class ));
462457 client .setConf (localConf );
463458 Thread appThread = new Thread (() -> {
464459 try {
0 commit comments