Skip to content

Commit 426c218

Browse files
committed
Improve ux of test with besu and shomei nodes
1 parent d8d8a05 commit 426c218

File tree

3 files changed

+24
-49
lines changed

3 files changed

+24
-49
lines changed

arithmetization/src/test/java/net/consensys/linea/replaytests/ReplayTestTools.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static org.junit.jupiter.api.Assertions.fail;
1919

2020
import java.io.BufferedReader;
21+
import java.io.File;
2122
import java.io.IOException;
2223
import java.io.InputStream;
2324
import java.io.InputStreamReader;
@@ -82,7 +83,7 @@ public static void replay(ChainConfig chain, String filename, boolean resultChec
8283
throw new RuntimeException(e);
8384
}
8485
ReplayExecutionEnvironment.builder()
85-
.filename(filename)
86+
.filename(new File(filename).getName())
8687
.zkTracer(new ZkTracer(chain))
8788
.txResultChecking(resultChecking)
8889
.build()

gradle/tests.gradle

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ jacocoTestReport {
128128
}
129129
}
130130

131-
tasks.test.configure {
132-
dependsOn("copyTracerPlugin", "downloadShoemiBesuPlugin")
131+
def setupTestForBesuAndShomei(Test test) {
132+
test.dependsOn("copyTracerPlugin", "downloadShoemiBesuPlugin")
133133

134134
delete("${project.getLayout().getBuildDirectory().get()}/besu/traces")
135135
mkdir("${project.getLayout().getBuildDirectory().get()}/besu/traces")
@@ -145,8 +145,13 @@ tasks.test.configure {
145145
)
146146
)
147147

148-
systemProperty("besu.traces.dir", System.getProperty("besu.traces.dir"))
149-
systemProperty("besu.plugins.dir", System.getProperty("besu.plugins.dir"))
148+
test.systemProperty("besu.traces.dir", System.getProperty("besu.traces.dir"))
149+
test.systemProperty("besu.plugins.dir", System.getProperty("besu.plugins.dir"))
150+
}
151+
152+
tasks.test.configure {
153+
154+
setupTestForBesuAndShomei (tasks.test)
150155

151156
systemProperty("junit.jupiter.execution.parallel.enabled", true)
152157
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
@@ -158,6 +163,7 @@ tasks.test.configure {
158163
useJUnitPlatform {
159164
excludeTags("nightly")
160165
excludeTags("replay")
166+
excludeTags("replay_with_besu")
161167
excludeTags("weekly")
162168
excludeTags("prc-calltests")
163169
}
@@ -167,32 +173,15 @@ tasks.test.configure {
167173
tasks.register("besuNodeTests", Test) {
168174
forkEvery = 1
169175
maxParallelForks = 3
176+
setupTestForBesuAndShomei(it)
170177

171-
dependsOn("copyTracerPlugin", "downloadShoemiBesuPlugin")
172-
173-
delete("${project.getLayout().getBuildDirectory().get()}/besu/traces")
174-
mkdir("${project.getLayout().getBuildDirectory().get()}/besu/traces")
175-
mkdir("${project.getLayout().getBuildDirectory().get()}/besu/plugins")
176-
System.setProperty("besu.plugins.dir",
177-
System.getenv().getOrDefault("besu.plugins.dir",
178-
"${project.getLayout().getBuildDirectory().get().toString()}/besu/plugins/"
179-
)
180-
)
181-
System.setProperty("besu.traces.dir",
182-
System.getenv().getOrDefault("besu.traces.dir",
183-
"${project.getLayout().getBuildDirectory().get().toString()}/besu/traces/"
184-
)
185-
)
186-
187-
188-
systemProperty("besu.traces.dir", System.getProperty("besu.traces.dir"))
189-
systemProperty("besu.plugins.dir", System.getProperty("besu.plugins.dir"))
190178
environment("RUN_WITH_BESU_NODE", true)
191179

192180
systemProperty("junit.jupiter.execution.parallel.enabled", false)
193181
useJUnitPlatform {
194182
excludeTags("nightly")
195183
excludeTags("replay")
184+
excludeTags("replay_with_besu")
196185
excludeTags("weekly")
197186
excludeTags("prc-calltests")
198187
}
@@ -229,36 +218,15 @@ tasks.register("fastReplayTests", Test) {
229218
finalizedBy(jacocoFastReplayTestsReport)
230219
}
231220

232-
tasks.register("besuNodeFastReplayTests", Test) {
221+
tasks.register("besuNodeReplayTests", Test) {
233222
forkEvery = 1
234223
maxParallelForks = 3
235-
236-
dependsOn("copyTracerPlugin", "downloadShoemiBesuPlugin")
237-
238-
delete("${project.getLayout().getBuildDirectory().get()}/besu/traces")
239-
mkdir("${project.getLayout().getBuildDirectory().get()}/besu/traces")
240-
mkdir("${project.getLayout().getBuildDirectory().get()}/besu/plugins")
241-
System.setProperty("besu.plugins.dir",
242-
System.getenv().getOrDefault("besu.plugins.dir",
243-
"${project.getLayout().getBuildDirectory().get().toString()}/besu/plugins/"
244-
)
245-
)
246-
System.setProperty("besu.traces.dir",
247-
System.getenv().getOrDefault("besu.traces.dir",
248-
"${project.getLayout().getBuildDirectory().get().toString()}/besu/traces/"
249-
)
250-
)
251-
252-
253-
systemProperty("besu.traces.dir", System.getProperty("besu.traces.dir"))
254-
systemProperty("besu.plugins.dir", System.getProperty("besu.plugins.dir"))
224+
setupTestForBesuAndShomei(it)
255225
environment("RUN_WITH_BESU_NODE", true)
256226

257227
systemProperty("junit.jupiter.execution.parallel.enabled", false)
258228
useJUnitPlatform {
259-
includeTags("replay")
260-
excludeTags("nightly")
261-
excludeTags("weekly")
229+
includeTags("replay_with_besu")
262230
}
263231
finalizedBy(jacocoTestReport)
264232
}

testing/src/main/java/net/consensys/linea/testing/BesuExecutionTools.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ public BesuExecutionTools(
9595
this.testName = tmpTestName.substring(0, Math.min(tmpTestName.length(), 200));
9696
int besuPort = findFreePort();
9797
int shomeiPort = findFreePort();
98-
this.httpClient = new OkHttpClient();
98+
this.httpClient =
99+
new OkHttpClient.Builder()
100+
.connectTimeout(10, java.util.concurrent.TimeUnit.MINUTES)
101+
.writeTimeout(10, java.util.concurrent.TimeUnit.MINUTES)
102+
.readTimeout(10, java.util.concurrent.TimeUnit.MINUTES)
103+
.callTimeout(10, java.util.concurrent.TimeUnit.MINUTES)
104+
.build();
99105
this.chainConfig = chainConfig;
100106
GenesisConfigBuilder genesisConfigBuilder = new GenesisConfigBuilder();
101107
genesisConfigBuilder.setChainId(chainConfig.id);

0 commit comments

Comments
 (0)