90
90
import org .apache .hadoop .ipc .RemoteException ;
91
91
import org .apache .hadoop .net .NetUtils ;
92
92
import org .apache .hadoop .net .NodeBase ;
93
- import org .junit .After ;
94
- import org .junit .Before ;
93
+ import org .junit .jupiter . api . AfterEach ;
94
+ import org .junit .jupiter . api . BeforeEach ;
95
95
import org .junit .Rule ;
96
- import org .junit .Test ;
96
+ import org .junit .jupiter .api .Test ;
97
+ import org .junit .jupiter .api .Timeout ;
97
98
import org .junit .rules .TestName ;
98
99
import org .slf4j .Logger ;
99
100
import org .slf4j .LoggerFactory ;
107
108
import static org .apache .hadoop .hdfs .server .common .Util .fileAsURI ;
108
109
import static org .apache .hadoop .hdfs .server .common .blockaliasmap .impl .TextFileRegionAliasMap .fileNameFromBlockPoolID ;
109
110
import static org .apache .hadoop .net .NodeBase .PATH_SEPARATOR_STR ;
110
- import static org .junit .Assert .*;
111
+ import static org .junit .jupiter . api . Assertions .*;
111
112
112
113
/**
113
114
* Integration tests for the Provided implementation.
@@ -136,7 +137,7 @@ public class ITestProvidedImplementation {
136
137
private Configuration conf ;
137
138
private MiniDFSCluster cluster ;
138
139
139
- @ Before
140
+ @ BeforeEach
140
141
public void setSeed () throws Exception {
141
142
if (fBASE .exists () && !FileUtil .fullyDelete (fBASE )) {
142
143
throw new IOException ("Could not fully delete " + fBASE );
@@ -196,7 +197,7 @@ public void setSeed() throws Exception {
196
197
}
197
198
}
198
199
199
- @ After
200
+ @ AfterEach
200
201
public void shutdown () throws Exception {
201
202
try {
202
203
if (cluster != null ) {
@@ -312,7 +313,8 @@ private static List<File> getProvidedNamenodeDirs(String baseDir,
312
313
return nnDirs ;
313
314
}
314
315
315
- @ Test (timeout =20000 )
316
+ @ Test
317
+ @ Timeout (value = 20 )
316
318
public void testLoadImage () throws Exception {
317
319
final long seed = r .nextLong ();
318
320
LOG .info ("providedPath: " + providedPath );
@@ -338,7 +340,8 @@ public void testLoadImage() throws Exception {
338
340
}
339
341
}
340
342
341
- @ Test (timeout =30000 )
343
+ @ Test
344
+ @ Timeout (value = 30 )
342
345
public void testProvidedReporting () throws Exception {
343
346
conf .setClass (ImageWriter .Options .UGI_CLASS ,
344
347
SingleUGIResolver .class , UGIResolver .class );
@@ -417,7 +420,8 @@ public void testProvidedReporting() throws Exception {
417
420
}
418
421
}
419
422
420
- @ Test (timeout =500000 )
423
+ @ Test
424
+ @ Timeout (value = 500 )
421
425
public void testDefaultReplication () throws Exception {
422
426
int targetReplication = 2 ;
423
427
conf .setInt (FixedBlockMultiReplicaResolver .REPLICATION , targetReplication );
@@ -529,7 +533,8 @@ private BlockLocation[] createFile(Path path, short replication,
529
533
return fs .getFileBlockLocations (path , 0 , fileLen );
530
534
}
531
535
532
- @ Test (timeout =30000 )
536
+ @ Test
537
+ @ Timeout (value = 30 )
533
538
public void testClusterWithEmptyImage () throws IOException {
534
539
// start a cluster with 2 datanodes without any provided storage
535
540
startCluster (nnDirPath , 2 , null ,
@@ -567,8 +572,8 @@ private DatanodeInfo[] getAndCheckBlockLocations(DFSClient client,
567
572
private void checkUniqueness (DatanodeInfo [] locations ) {
568
573
Set <String > set = new HashSet <>();
569
574
for (DatanodeInfo info : locations ) {
570
- assertFalse ("All locations should be unique" ,
571
- set .contains (info .getDatanodeUuid ()));
575
+ assertFalse (
576
+ set .contains (info .getDatanodeUuid ()), "All locations should be unique" );
572
577
set .add (info .getDatanodeUuid ());
573
578
}
574
579
}
@@ -577,7 +582,8 @@ private void checkUniqueness(DatanodeInfo[] locations) {
577
582
* Tests setting replication of provided files.
578
583
* @throws Exception
579
584
*/
580
- @ Test (timeout =50000 )
585
+ @ Test
586
+ @ Timeout (value = 50 )
581
587
public void testSetReplicationForProvidedFiles () throws Exception {
582
588
createImage (new FSTreeWalk (providedPath , conf ), nnDirPath ,
583
589
FixedBlockResolver .class );
@@ -618,7 +624,8 @@ private void setAndUnsetReplication(String filename) throws Exception {
618
624
defaultReplication );
619
625
}
620
626
621
- @ Test (timeout =30000 )
627
+ @ Test
628
+ @ Timeout (value = 30 )
622
629
public void testProvidedDatanodeFailures () throws Exception {
623
630
createImage (new FSTreeWalk (providedPath , conf ), nnDirPath ,
624
631
FixedBlockResolver .class );
@@ -689,7 +696,8 @@ public void testProvidedDatanodeFailures() throws Exception {
689
696
}
690
697
}
691
698
692
- @ Test (timeout =300000 )
699
+ @ Test
700
+ @ Timeout (value = 300 )
693
701
public void testTransientDeadDatanodes () throws Exception {
694
702
createImage (new FSTreeWalk (providedPath , conf ), nnDirPath ,
695
703
FixedBlockResolver .class );
@@ -727,7 +735,8 @@ private DatanodeStorageInfo getProvidedDatanodeStorageInfo() {
727
735
return providedStorageMap .getProvidedStorageInfo ();
728
736
}
729
737
730
- @ Test (timeout =30000 )
738
+ @ Test
739
+ @ Timeout (value = 30 )
731
740
public void testNamenodeRestart () throws Exception {
732
741
createImage (new FSTreeWalk (providedPath , conf ), nnDirPath ,
733
742
FixedBlockResolver .class );
@@ -768,7 +777,8 @@ private void verifyFileLocation(int fileIndex, int replication)
768
777
}
769
778
}
770
779
771
- @ Test (timeout =30000 )
780
+ @ Test
781
+ @ Timeout (value = 30 )
772
782
public void testSetClusterID () throws Exception {
773
783
String clusterID = "PROVIDED-CLUSTER" ;
774
784
createImage (new FSTreeWalk (providedPath , conf ), nnDirPath ,
@@ -783,7 +793,8 @@ public void testSetClusterID() throws Exception {
783
793
assertEquals (clusterID , nn .getNamesystem ().getClusterId ());
784
794
}
785
795
786
- @ Test (timeout =30000 )
796
+ @ Test
797
+ @ Timeout (value = 30 )
787
798
public void testNumberOfProvidedLocations () throws Exception {
788
799
// set default replication to 4
789
800
conf .setInt (DFSConfigKeys .DFS_REPLICATION_KEY , 4 );
@@ -814,7 +825,8 @@ public void testNumberOfProvidedLocations() throws Exception {
814
825
}
815
826
}
816
827
817
- @ Test (timeout =30000 )
828
+ @ Test
829
+ @ Timeout (value = 30 )
818
830
public void testNumberOfProvidedLocationsManyBlocks () throws Exception {
819
831
// increase number of blocks per file to at least 10 blocks per file
820
832
conf .setLong (FixedBlockResolver .BLOCKSIZE , baseFileLen /10 );
0 commit comments