kezhuw commented on code in PR #1852:
URL: https://github.com/apache/zookeeper/pull/1852#discussion_r902455844
##########
zookeeper-server/src/test/java/org/apache/zookeeper/server/persistence/FileTxnSnapLogMetricsTest.java:
##########
@@ -43,38 +40,20 @@
private static final Logger LOG =
LoggerFactory.getLogger(FileTxnSnapLogMetricsTest.class);
- CountDownLatch allCreatedLatch;
-
- private class MockWatcher implements Watcher {
-
- @Override
- public void process(WatchedEvent e) {
- LOG.info("all nodes created");
- allCreatedLatch.countDown();
- }
-
- }
-
@Test
public void testFileTxnSnapLogMetrics() throws Exception {
- SyncRequestProcessor.setSnapCount(100);
+ // disable automatic snapshot taking to leave writes in txn log
+ SyncRequestProcessor.setSnapCount(Integer.MAX_VALUE);
Review Comment:
Cleanup is always a complicated problem. No ones run in identical
environment.
> setting back all "static stuff" we changed in a test is a good practice.
It is actually hard to follow. Given `SyncRequestProcessor.setSnapCount` as
an example, there are 20+ usages in test, only `RecoveryTest.testRecovery`
restores.
Personally, I treat all tests as oneshot and resort to junit's `@Rule`(eg.
`@TempDir`) or similars to cleanup persistent resources.
Anyway, I will add a `@AfterEach` to restore it back in next fixup. 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]