18
18
19
19
import org .apache .kafka .common .Uuid ;
20
20
import org .apache .kafka .common .compress .Compression ;
21
- import org .apache .kafka .common .errors .KafkaStorageException ;
22
21
import org .apache .kafka .common .record .ControlRecordType ;
23
22
import org .apache .kafka .common .record .MemoryRecords ;
24
23
import org .apache .kafka .common .record .RecordBatch ;
@@ -65,13 +64,7 @@ public class UnifiedLogTest {
65
64
public void tearDown () throws IOException {
66
65
brokerTopicStats .close ();
67
66
for (UnifiedLog log : logsToClose ) {
68
- try {
69
- // some test like testLogDeletionAfterClose and testLogDeletionAfterClose
70
- // they are closed from test so KafkaStorageException is expected.
71
- log .close ();
72
- } catch (KafkaStorageException ignore ) {
73
- // ignore
74
- }
67
+ log .close ();
75
68
}
76
69
Utils .delete (tmpDir );
77
70
}
@@ -448,6 +441,8 @@ public void testLogDeletionAfterClose() throws IOException {
448
441
.withRetentionMs (999 )
449
442
.build ();
450
443
log = createLog (logDir , logConfig );
444
+ // avoid close after test because it is closed in this test
445
+ logsToClose .remove (log );
451
446
452
447
// append some messages to create some segments
453
448
log .appendAsLeader (records .get (), 0 );
@@ -470,6 +465,8 @@ public void testDeleteOldSegments() throws IOException {
470
465
.withRetentionMs (999 )
471
466
.build ();
472
467
log = createLog (logDir , logConfig );
468
+ // avoid close after test because it is closed in this test
469
+ logsToClose .remove (log );
473
470
474
471
// append some messages to create some segments
475
472
for (int i = 0 ; i < 100 ; i ++) {
0 commit comments