Skip to content

Commit

Permalink
addresses review:
Browse files Browse the repository at this point in the history
- Moves the methods from MultipleStoresTestRunner into MultipleStoresIT
  and removes MultipleStoresTestRunner
- Removes unneccessary start of mini cluster in MetaMultipleStoresIT
  • Loading branch information
kevinrr888 committed Oct 21, 2024
1 parent 4be2214 commit eb74934
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
import org.apache.accumulo.harness.SharedMiniClusterBase;
import org.apache.accumulo.test.util.Wait;
import org.apache.zookeeper.KeeperException;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.Sets;

public abstract class MultipleStoresIT extends SharedMiniClusterBase
implements MultipleStoresTestRunner {
public abstract class MultipleStoresIT extends SharedMiniClusterBase {

private static final Logger LOG = LoggerFactory.getLogger(MultipleStoresIT.class);

Expand Down Expand Up @@ -446,4 +446,22 @@ public static class LatchTestEnv extends MultipleStoresTestEnv {
public final AtomicInteger numWorkers = new AtomicInteger(0);
public final CountDownLatch workersLatch = new CountDownLatch(1);
}

protected abstract void executeSleepingEnvTest(
MultipleStoresTestExecutor<SleepingTestEnv> testMethod) throws Exception;

protected abstract void executeLatchEnvTest(MultipleStoresTestExecutor<LatchTestEnv> testMethod)
throws Exception;

protected interface TestStoreFactory<T extends MultipleStoresTestEnv> {
FateStore<T> create(ZooUtil.LockID lockID, Predicate<ZooUtil.LockID> isLockHeld)
throws InterruptedException, KeeperException;
}

@FunctionalInterface
protected interface MultipleStoresTestExecutor<T extends MultipleStoresTestEnv> {
void execute(TestStoreFactory<T> fateStoreFactory) throws Exception;
}

protected static class MultipleStoresTestEnv {}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.accumulo.core.fate.zookeeper.MetaFateStore;
import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
import org.apache.accumulo.harness.SharedMiniClusterBase;
import org.apache.accumulo.test.fate.MultipleStoresIT;
import org.apache.accumulo.test.zookeeper.ZooKeeperTestingServer;
import org.apache.zookeeper.KeeperException;
Expand All @@ -43,7 +42,6 @@ public class MetaMultipleStoresIT extends MultipleStoresIT {

@BeforeAll
public static void setup() throws Exception {
SharedMiniClusterBase.startMiniCluster();
SZK = new ZooKeeperTestingServer(TEMP_DIR);
ZK = SZK.getZooReaderWriter();
FATE_DIR = Constants.ZFATE;
Expand All @@ -52,17 +50,16 @@ public static void setup() throws Exception {
@AfterAll
public static void teardown() throws Exception {
SZK.close();
SharedMiniClusterBase.stopMiniCluster();
}

@Override
public void executeSleepingEnvTest(MultipleStoresTestExecutor<SleepingTestEnv> testMethod)
protected void executeSleepingEnvTest(MultipleStoresTestExecutor<SleepingTestEnv> testMethod)
throws Exception {
testMethod.execute(new SleepingEnvMetaStoreFactory());
}

@Override
public void executeLatchEnvTest(MultipleStoresTestExecutor<LatchTestEnv> testMethod)
protected void executeLatchEnvTest(MultipleStoresTestExecutor<LatchTestEnv> testMethod)
throws Exception {
testMethod.execute(new LatchEnvMetaStoreFactory());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ public void afterEachTeardown()
}

@Override
public void executeSleepingEnvTest(MultipleStoresTestExecutor<SleepingTestEnv> testMethod)
protected void executeSleepingEnvTest(MultipleStoresTestExecutor<SleepingTestEnv> testMethod)
throws Exception {
testMethod.execute(new SleepingEnvUserStoreFactory());
}

@Override
public void executeLatchEnvTest(MultipleStoresTestExecutor<LatchTestEnv> testMethod)
protected void executeLatchEnvTest(MultipleStoresTestExecutor<LatchTestEnv> testMethod)
throws Exception {
testMethod.execute(new LatchEnvUserStoreFactory());
}
Expand Down

0 comments on commit eb74934

Please sign in to comment.