Skip to content

Commit 8c709cc

Browse files
committed
Better convex-integration testing
1 parent 0e72b07 commit 8c709cc

3 files changed

Lines changed: 81 additions & 15 deletions

File tree

convex-integration/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Convex Integration
2+
3+
This module is used for contructing primary Convex artifacts and integration testing.
4+
5+
## `convex.jar` construction
6+
7+
The `convex-integration` module builds `convex.jar` as a fat jar with dependencies for convenient distribution and usage (e.g. at the CLI)
8+
9+
## Integration Tests
10+
11+
To run live integration tests do:
12+
13+
```bash
14+
mvn verify -Pintegration-tests
15+
```

convex-integration/pom.xml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919

2020
<build>
2121
<plugins>
22+
<plugin>
23+
<groupId>org.apache.maven.plugins</groupId>
24+
<artifactId>maven-surefire-plugin</artifactId>
25+
<configuration>
26+
<!-- Run only unit tests, exclude slow / environment dependentintegration tests -->
27+
<excludes>
28+
<exclude>**/*IT.java</exclude>
29+
</excludes>
30+
</configuration>
31+
</plugin>
32+
2233
<plugin>
2334
<artifactId>maven-assembly-plugin</artifactId>
2435
<version>3.7.1</version>
@@ -55,6 +66,53 @@
5566
</plugin>
5667
</plugins>
5768
</build>
69+
70+
<profiles>
71+
<profile>
72+
<id>integration-tests</id>
73+
74+
<build>
75+
<plugins>
76+
<!-- Failsafe runs the heavy live integration tests -->
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-failsafe-plugin</artifactId>
80+
<version>3.5.4</version>
81+
<executions>
82+
<execution>
83+
<goals>
84+
<goal>integration-test</goal>
85+
<goal>verify</goal>
86+
</goals>
87+
<configuration>
88+
89+
<!-- Live environment -->
90+
<systemPropertyVariables>
91+
<convex.peer.url>https://peer.convex.live</convex.peer.url>
92+
<spring.profiles.active>live</spring.profiles.active>
93+
</systemPropertyVariables>
94+
95+
<!-- Optional: run in parallel, fail fast, etc. -->
96+
<parallel>classes</parallel>
97+
<threadCount>4</threadCount>
98+
<failIfNoTests>true</failIfNoTests>
99+
</configuration>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
104+
<!-- Optional: completely skip surefire when running integration tests -->
105+
<plugin>
106+
<groupId>org.apache.maven.plugins</groupId>
107+
<artifactId>maven-surefire-plugin</artifactId>
108+
<configuration>
109+
<skip>true</skip>
110+
</configuration>
111+
</plugin>
112+
</plugins>
113+
</build>
114+
</profile>
115+
</profiles>
58116

59117
<dependencies>
60118
<dependency>

convex-integration/src/test/java/convex/java/RemoteRESTClientTest.java renamed to convex-integration/src/test/java/convex/java/RemoteRESTClientIT.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,21 @@
1616
import convex.core.cvm.Address;
1717
import convex.core.util.JSON;
1818

19-
public class RemoteRESTClientTest {
19+
public class RemoteRESTClientIT {
2020

2121
// Use to skip remote tests
22-
static boolean skip=true;
22+
static boolean skip=false;
2323

24-
static final String TEST_PEER="https://convex.world";
24+
static final String TEST_PEER="https://mikera1337-convex-testnet.hf.space";
2525

2626
public ConvexJSON getNewConvex() {
2727
if (skip) return null;
2828
AKeyPair kp=AKeyPair.generate();
29-
try {
30-
ConvexJSON convex=ConvexJSON.connect(TEST_PEER);
31-
Address addr=convex.createAccount(kp);
32-
convex.setAddress(addr);
33-
convex.setKeyPair(kp);
34-
return convex;
35-
} catch (Exception e) {
36-
skip=true;
37-
return null;
38-
}
39-
29+
ConvexJSON convex=ConvexJSON.connect(TEST_PEER);
30+
Address addr=convex.createAccount(kp);
31+
convex.setAddress(addr);
32+
convex.setKeyPair(kp);
33+
return convex;
4034
}
4135

4236
@Test public void testQuery() {
@@ -56,7 +50,6 @@ public ConvexJSON getNewConvex() {
5650
assertTrue(result.containsKey("memorySize"));
5751
}
5852

59-
6053
@Test public void testQueryAsync() throws InterruptedException, ExecutionException {
6154
ConvexJSON convex=getNewConvex();
6255
checkValid(convex);

0 commit comments

Comments
 (0)