Skip to content

Commit

Permalink
Merge pull request #55 from thinkAfCod/fix_test
Browse files Browse the repository at this point in the history
fix: inner watcher test case
  • Loading branch information
thinkAfCod authored Nov 4, 2023
2 parents 1dc15b5 + ea4adb2 commit e3c2305
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion hildr-node/src/test/java/io/optimism/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ private TestConstants() {}
/** The L 1 rpc url format. */
static String l1RpcUrlFormat = "https://eth-goerli.g.alchemy.com/v2/%s";

static String l1RpcWsUrlFormat = "wss://eth-goerli.g.alchemy.com/v2/%s";

/** The L 2 rpc url format. */
static String l2RpcUrlFormat = "https://opt-goerli.g.alchemy.com/v2/%s";

Expand All @@ -53,9 +55,10 @@ public static Config createConfig() {
return null;
}
var l1RpcUrl = l1RpcUrlFormat.formatted(envs.get(ETH_API_ENV));
var l1WsRpcUrl = l1RpcWsUrlFormat.formatted(envs.get(ETH_API_ENV));
var l2RpcUrl = l2RpcUrlFormat.formatted(envs.get(OPT_API_ENV));
Config.CliConfig cliConfig =
new Config.CliConfig(l1RpcUrl, l2RpcUrl, null, "testjwt", null, null, false);
new Config.CliConfig(l1WsRpcUrl, l2RpcUrl, null, "testjwt", null, null, false);
return Config.create(null, cliConfig, Config.ChainConfig.optimismGoerli());
}
}
4 changes: 2 additions & 2 deletions hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.optimism.TestConstants;
import io.optimism.config.Config;
import java.math.BigInteger;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.jctools.queues.MessagePassingQueue;
Expand Down Expand Up @@ -76,13 +75,14 @@ void testCreateInnerWatcher() {
}

@Test
void testTryIngestBlock() throws ExecutionException, InterruptedException {
void testTryIngestBlock() throws Exception {
if (!TestConstants.isConfiguredApiKeyEnv) {
return;
}
ExecutorService executor = Executors.newSingleThreadExecutor();
var queue = new MpscGrowableArrayQueue<BlockUpdate>(1024 * 4, 1024 * 64);
var watcher = this.createWatcher(null, queue, executor);
watcher.startUp();
watcher.tryIngestBlock();
assertEquals(2, queue.size());
}
Expand Down

0 comments on commit e3c2305

Please sign in to comment.