Add shutdown hook in StatemachineSnapshotFileGeneratorTest

This commit is contained in:
hzh0425
2023-01-02 19:46:01 +08:00
parent 8207a8c4d3
commit 90da4923e7
@@ -16,10 +16,12 @@
*/
package org.apache.rocketmq.controller.impl.controller.impl.statemachine;
import org.apache.rocketmq.common.UtilAll;
import org.apache.rocketmq.controller.impl.manager.BrokerInfo;
import org.apache.rocketmq.controller.impl.manager.ReplicasInfoManager;
import org.apache.rocketmq.controller.impl.manager.SyncStateInfo;
import org.apache.rocketmq.controller.impl.statemachine.StatemachineSnapshotFileGenerator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -75,6 +77,11 @@ public class StatemachineSnapshotFileGeneratorTest {
this.snapshotGenerator = new StatemachineSnapshotFileGenerator(Collections.singletonList(this.replicasInfoManager));
}
@After
public void shutdown() {
UtilAll.deleteFile(new File(this.snapshotPath));
}
@Test
public void testGenerateAndLoadEmptySnapshot() throws IOException {
ReplicasInfoManager emptyManager = new ReplicasInfoManager(null);