From ea4adb2f35a0c0147bc7b479b88410705ad691be Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Sat, 4 Nov 2023 12:02:38 +0800 Subject: [PATCH] fix: inner watcher test case --- hildr-node/src/test/java/io/optimism/TestConstants.java | 5 ++++- .../src/test/java/io/optimism/l1/InnerWatcherTest.java | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hildr-node/src/test/java/io/optimism/TestConstants.java b/hildr-node/src/test/java/io/optimism/TestConstants.java index 308a962e..643b968d 100644 --- a/hildr-node/src/test/java/io/optimism/TestConstants.java +++ b/hildr-node/src/test/java/io/optimism/TestConstants.java @@ -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"; @@ -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()); } } diff --git a/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java b/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java index 7583ac72..1e234e8c 100644 --- a/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java +++ b/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java @@ -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; @@ -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(1024 * 4, 1024 * 64); var watcher = this.createWatcher(null, queue, executor); + watcher.startUp(); watcher.tryIngestBlock(); assertEquals(2, queue.size()); }