Skip to content

Commit abc8666

Browse files
Java: add CI to run modules (#2388)
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
1 parent 615034f commit abc8666

File tree

5 files changed

+110
-4
lines changed

5 files changed

+110
-4
lines changed

.github/workflows/java.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ jobs:
5757
engine: ${{ fromJson(needs.load-engine-matrix.outputs.matrix) }}
5858
host:
5959
- {
60-
OS: ubuntu,
61-
RUNNER: ubuntu-latest,
62-
TARGET: x86_64-unknown-linux-gnu
63-
}
60+
OS: ubuntu,
61+
RUNNER: ubuntu-latest,
62+
TARGET: x86_64-unknown-linux-gnu,
63+
}
6464
# - {
6565
# OS: macos,
6666
# RUNNER: macos-latest,
@@ -195,3 +195,41 @@ jobs:
195195
with:
196196
cargo-toml-folder: ./java
197197
name: lint java rust
198+
199+
test-modules:
200+
if: github.repository_owner == 'valkey-io'
201+
name: Running Module Tests
202+
runs-on: [self-hosted, linux, ARM64]
203+
timeout-minutes: 15
204+
steps:
205+
- name: Setup self-hosted runner access
206+
run: sudo chown -R $USER:$USER /home/ubuntu/actions-runner/_work/valkey-glide
207+
208+
- uses: actions/checkout@v4
209+
with:
210+
submodules: recursive
211+
212+
- name: Set up JDK
213+
uses: actions/setup-java@v4
214+
with:
215+
distribution: "temurin"
216+
java-version: 17
217+
218+
- name: Install protoc (protobuf)
219+
uses: arduino/setup-protoc@v3
220+
with:
221+
version: "26.1"
222+
repo-token: ${{ secrets.GITHUB_TOKEN }}
223+
224+
- name: Test java wrapper
225+
working-directory: java
226+
run: ./gradlew :integTest:modulesTest -Dcluster-endpoints=${{ secrets.MEMDB_MODULES_ENDPOINT }} -Dtls=true
227+
228+
- name: Upload test reports
229+
if: always()
230+
continue-on-error: true
231+
uses: actions/upload-artifact@v4
232+
with:
233+
name: test-reports-modules
234+
path: |
235+
java/integTest/build/reports/**

java/DEVELOPER.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ You can combine this with test filter as well:
263263
./gradlew :integTest:test -Dcluster-endpoints=localhost:7000 -Dstandalone-endpoints=localhost:6379 --tests 'TransactionTests' -Dtls=true
264264
```
265265
266+
To run server modules test (it doesn't start servers):
267+
```bash
268+
./gradlew :integTest:modulesTest -Dcluster-endpoints=localhost:7000 -Dtls=true
269+
```
270+
266271
### Generate files
267272
To (re)generate protobuf code, use the following command:
268273

java/integTest/build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,19 @@ tasks.withType(Test) {
132132
logger.quiet "${desc.className}.${desc.name}: ${result.resultType} ${(result.getEndTime() - result.getStartTime())/1000}s"
133133
}
134134
}
135+
136+
test {
137+
filter {
138+
excludeTestsMatching 'glide.modules.*'
139+
}
140+
}
141+
142+
tasks.register('modulesTest', Test) {
143+
doFirst {
144+
clusterHosts = System.getProperty("cluster-endpoints")
145+
}
146+
147+
filter {
148+
includeTestsMatching 'glide.modules.*'
149+
}
150+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */
2+
package glide.modules;
3+
4+
import static glide.TestUtilities.commonClusterClientConfig;
5+
import static glide.api.models.configuration.RequestRoutingConfiguration.SimpleSingleNodeRoute.RANDOM;
6+
import static org.junit.jupiter.api.Assertions.assertTrue;
7+
8+
import glide.api.GlideClusterClient;
9+
import glide.api.models.commands.InfoOptions.Section;
10+
import lombok.SneakyThrows;
11+
import org.junit.jupiter.api.Test;
12+
13+
public class JsonTests {
14+
@Test
15+
@SneakyThrows
16+
public void check_module_loaded() {
17+
var client =
18+
GlideClusterClient.createClient(commonClusterClientConfig().requestTimeout(5000).build())
19+
.get();
20+
var info = client.info(new Section[] {Section.MODULES}, RANDOM).get().getSingleValue();
21+
assertTrue(info.contains("# json_core_metrics"));
22+
}
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */
2+
package glide.modules;
3+
4+
import static glide.TestUtilities.commonClusterClientConfig;
5+
import static glide.api.models.configuration.RequestRoutingConfiguration.SimpleSingleNodeRoute.RANDOM;
6+
import static org.junit.jupiter.api.Assertions.assertTrue;
7+
8+
import glide.api.GlideClusterClient;
9+
import glide.api.models.commands.InfoOptions.Section;
10+
import lombok.SneakyThrows;
11+
import org.junit.jupiter.api.Test;
12+
13+
public class VectorSearchTests {
14+
15+
@Test
16+
@SneakyThrows
17+
public void check_module_loaded() {
18+
var client =
19+
GlideClusterClient.createClient(commonClusterClientConfig().requestTimeout(5000).build())
20+
.get();
21+
var info = client.info(new Section[] {Section.MODULES}, RANDOM).get().getSingleValue();
22+
assertTrue(info.contains("# search_index_stats"));
23+
}
24+
}

0 commit comments

Comments
 (0)