31
31
import org .apache .hadoop .hdfs .protocol .DirectoryListing ;
32
32
import org .apache .hadoop .hdfs .protocol .HdfsFileStatus ;
33
33
import org .apache .hadoop .util .ExitUtil ;
34
- import org .junit .After ;
35
- import org .junit .Assert ;
36
- import org .junit .BeforeClass ;
37
- import org .junit .Test ;
34
+ import org .junit .jupiter .api .AfterEach ;
35
+ import org .junit .jupiter .api .BeforeAll ;
36
+ import org .junit .jupiter .api .Test ;
37
+ import org .junit .jupiter .api .Timeout ;
38
+
39
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
40
+ import static org .junit .jupiter .api .Assertions .assertFalse ;
41
+ import static org .junit .jupiter .api .Assertions .assertNotEquals ;
42
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
38
43
39
44
public class TestNNThroughputBenchmark {
40
45
41
- @ BeforeClass
46
+ @ BeforeAll
42
47
public static void setUp () {
43
48
ExitUtil .disableSystemExit ();
44
49
}
45
50
46
- @ After
51
+ @ AfterEach
47
52
public void cleanUp () {
48
53
FileUtil .fullyDeleteContents (new File (MiniDFSCluster .getBaseDirectory ()));
49
54
}
@@ -66,7 +71,8 @@ public void testNNThroughput() throws Exception {
66
71
* This test runs all benchmarks defined in {@link NNThroughputBenchmark},
67
72
* with explicit local -fs option.
68
73
*/
69
- @ Test (timeout = 120000 )
74
+ @ Test
75
+ @ Timeout (value = 120 )
70
76
public void testNNThroughputWithFsOption () throws Exception {
71
77
Configuration conf = new HdfsConfiguration ();
72
78
conf .setInt (DFSConfigKeys .DFS_BLOCK_SIZE_KEY , 16 );
@@ -81,7 +87,8 @@ public void testNNThroughputWithFsOption() throws Exception {
81
87
/**
82
88
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster.
83
89
*/
84
- @ Test (timeout = 120000 )
90
+ @ Test
91
+ @ Timeout (value = 120 )
85
92
public void testNNThroughputAgainstRemoteNN () throws Exception {
86
93
final Configuration conf = new HdfsConfiguration ();
87
94
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -106,7 +113,8 @@ public void testNNThroughputAgainstRemoteNN() throws Exception {
106
113
* Ranger since only super user e.g. hdfs can enter/exit safemode
107
114
* but any request from super user is not sent for authorization).
108
115
*/
109
- @ Test (timeout = 120000 )
116
+ @ Test
117
+ @ Timeout (value = 120 )
110
118
public void testNNThroughputAgainstRemoteNNNonSuperUser () throws Exception {
111
119
final Configuration conf = new HdfsConfiguration ();
112
120
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -128,7 +136,8 @@ public void testNNThroughputAgainstRemoteNNNonSuperUser() throws Exception {
128
136
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
129
137
* with explicit -fs option.
130
138
*/
131
- @ Test (timeout = 120000 )
139
+ @ Test
140
+ @ Timeout (value = 120 )
132
141
public void testNNThroughputRemoteAgainstNNWithFsOption () throws Exception {
133
142
final Configuration conf = new HdfsConfiguration ();
134
143
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -153,7 +162,8 @@ public void testNNThroughputRemoteAgainstNNWithFsOption() throws Exception {
153
162
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
154
163
* for append operation.
155
164
*/
156
- @ Test (timeout = 120000 )
165
+ @ Test
166
+ @ Timeout (value = 120 )
157
167
public void testNNThroughputForAppendOp () throws Exception {
158
168
final Configuration conf = new HdfsConfiguration ();
159
169
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -178,10 +188,10 @@ public void testNNThroughputForAppendOp() throws Exception {
178
188
listing = fsNamesystem .getListing ("/" , HdfsFileStatus .EMPTY_NAME , false );
179
189
HdfsFileStatus [] partialListingAfter = listing .getPartialListing ();
180
190
181
- Assert . assertEquals (partialListing .length , partialListingAfter .length );
191
+ assertEquals (partialListing .length , partialListingAfter .length );
182
192
for (int i = 0 ; i < partialListing .length ; i ++) {
183
193
//Check the modification time after append operation
184
- Assert . assertNotEquals (partialListing [i ].getModificationTime (),
194
+ assertNotEquals (partialListing [i ].getModificationTime (),
185
195
partialListingAfter [i ].getModificationTime ());
186
196
}
187
197
@@ -196,7 +206,8 @@ public void testNNThroughputForAppendOp() throws Exception {
196
206
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
197
207
* for block report operation.
198
208
*/
199
- @ Test (timeout = 120000 )
209
+ @ Test
210
+ @ Timeout (value = 120 )
200
211
public void testNNThroughputForBlockReportOp () throws Exception {
201
212
final Configuration conf = new HdfsConfiguration ();
202
213
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -217,7 +228,8 @@ public void testNNThroughputForBlockReportOp() throws Exception {
217
228
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
218
229
* with explicit -baseDirName option.
219
230
*/
220
- @ Test (timeout = 120000 )
231
+ @ Test
232
+ @ Timeout (value = 120 )
221
233
public void testNNThroughputWithBaseDir () throws Exception {
222
234
final Configuration conf = new HdfsConfiguration ();
223
235
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -233,13 +245,13 @@ public void testNNThroughputWithBaseDir() throws Exception {
233
245
NNThroughputBenchmark .runBenchmark (benchConf ,
234
246
new String [] {"-op" , "create" , "-keepResults" , "-files" , "3" , "-baseDirName" ,
235
247
"/nnThroughputBenchmark1" , "-close" });
236
- Assert . assertTrue (fs .exists (new Path ("/nnThroughputBenchmark1" )));
237
- Assert . assertFalse (fs .exists (new Path ("/nnThroughputBenchmark" )));
248
+ assertTrue (fs .exists (new Path ("/nnThroughputBenchmark1" )));
249
+ assertFalse (fs .exists (new Path ("/nnThroughputBenchmark" )));
238
250
239
251
NNThroughputBenchmark .runBenchmark (benchConf ,
240
252
new String [] {"-op" , "all" , "-baseDirName" , "/nnThroughputBenchmark1" });
241
- Assert . assertTrue (fs .exists (new Path ("/nnThroughputBenchmark1" )));
242
- Assert . assertFalse (fs .exists (new Path ("/nnThroughputBenchmark" )));
253
+ assertTrue (fs .exists (new Path ("/nnThroughputBenchmark1" )));
254
+ assertFalse (fs .exists (new Path ("/nnThroughputBenchmark" )));
243
255
} finally {
244
256
if (cluster != null ) {
245
257
cluster .shutdown ();
@@ -251,7 +263,8 @@ public void testNNThroughputWithBaseDir() throws Exception {
251
263
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
252
264
* for blockSize with letter suffix.
253
265
*/
254
- @ Test (timeout = 120000 )
266
+ @ Test
267
+ @ Timeout (value = 120 )
255
268
public void testNNThroughputForBlockSizeWithLetterSuffix () throws Exception {
256
269
final Configuration conf = new HdfsConfiguration ();
257
270
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -271,7 +284,8 @@ public void testNNThroughputForBlockSizeWithLetterSuffix() throws Exception {
271
284
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
272
285
* with explicit -blockSize option.
273
286
*/
274
- @ Test (timeout = 120000 )
287
+ @ Test
288
+ @ Timeout (value = 120 )
275
289
public void testNNThroughputWithBlockSize () throws Exception {
276
290
final Configuration conf = new HdfsConfiguration ();
277
291
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
@@ -290,7 +304,8 @@ public void testNNThroughputWithBlockSize() throws Exception {
290
304
* This test runs {@link NNThroughputBenchmark} against a mini DFS cluster
291
305
* with explicit -blockSize option like 1m.
292
306
*/
293
- @ Test (timeout = 120000 )
307
+ @ Test
308
+ @ Timeout (value = 120 )
294
309
public void testNNThroughputBlockSizeArgWithLetterSuffix () throws Exception {
295
310
final Configuration conf = new HdfsConfiguration ();
296
311
conf .setInt (DFSConfigKeys .DFS_NAMENODE_MIN_BLOCK_SIZE_KEY , 16 );
0 commit comments