Skip to content

Commit 51635b9

Browse files
authored
Merge pull request #493 from weaviate/v6-minimal-version
v6: Enforce minimal server version
2 parents ab9967b + 0f43304 commit 51635b9

20 files changed

Lines changed: 382 additions & 175 deletions

File tree

.github/workflows/test.yaml

Lines changed: 99 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,118 @@ on:
44
branches:
55
- main
66
pull_request:
7+
concurrency:
8+
group: tests-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
env:
12+
IMG2VEC: cr.weaviate.io/semitechnologies/img2vec-pytorch:resnet50
13+
MINIO: minio/minio
14+
MODEL2VEC: cr.weaviate.io/semitechnologies/model2vec-inference:minishlab-potion-base-4M
15+
DOCKER_IMAGES_TAR: docker-images.tar
716

817
jobs:
9-
tests:
10-
name: Tests
18+
docker-cache:
19+
name: Cache shared Docker images
1120
runs-on: ubuntu-latest
1221
steps:
13-
- uses: actions/checkout@v4
14-
with:
15-
ref: ${{ github.sha }}
1622
- name: Login to Docker Hub
1723
if: ${{ !github.event.pull_request.head.repo.fork }}
18-
uses: docker/login-action@v2
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
- id: cache-check
29+
uses: actions/cache/restore@v4
30+
env:
31+
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
32+
with:
33+
path: ${{ env.DOCKER_IMAGES_TAR }}
34+
key: ${{ env.DOCKER_CACHE_KEY }}
35+
lookup-only: true # Only check if cache exists, don't download
36+
- name: Free Disk Space (Ubuntu)
37+
uses: jlumbroso/free-disk-space@v1.3.1
38+
with:
39+
tool-cache: false
40+
android: true
41+
dotnet: true
42+
haskell: true
43+
large-packages: true
44+
docker-images: false
45+
swap-storage: false
46+
- name: Pull images
47+
if: steps.cache-check.outputs.cache-hit != 'true'
48+
run: |
49+
docker pull $IMG2VEC
50+
docker pull $MINIO
51+
# docker pull $MODEL2VEC
52+
docker save $IMG2VEC $MINIO -o $DOCKER_IMAGES_TAR
53+
- name: Cache images
54+
if: steps.cache-check.outputs.cache-hit != 'true'
55+
uses: actions/cache/save@v4
56+
env:
57+
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
58+
with:
59+
path: ${{ env.DOCKER_IMAGES_TAR }}
60+
key: ${{ env.DOCKER_CACHE_KEY }}
61+
62+
maven-cache:
63+
name: Cache Maven dependencies
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-java@v4
68+
with:
69+
distribution: 'zulu'
70+
java-version: '17'
71+
cache: 'maven'
72+
- run: mvn dependency:go-offline
73+
74+
test:
75+
name: Test
76+
runs-on: ubuntu-latest
77+
needs: [ docker-cache, maven-cache]
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
WEAVIATE_VERSION: ["1.32.16", "1.33.4", "1.34.0"]
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- uses: actions/cache/restore@v4
86+
env:
87+
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
1988
with:
20-
username: ${{secrets.DOCKER_USERNAME}}
21-
password: ${{secrets.DOCKER_PASSWORD}}
22-
- name: Setup JDK
23-
uses: actions/setup-java@v4
89+
path: ${{ env.DOCKER_IMAGES_TAR }}
90+
key: ${{ env.DOCKER_CACHE_KEY }}
91+
- name: Free Disk Space (Ubuntu)
92+
uses: jlumbroso/free-disk-space@v1.3.1
93+
with:
94+
tool-cache: false
95+
android: true
96+
dotnet: true
97+
haskell: true
98+
large-packages: true
99+
docker-images: false
100+
swap-storage: false
101+
- name: Load Docker images
102+
run: |
103+
if [ -f $DOCKER_IMAGES_TAR ]; then
104+
docker load -i $DOCKER_IMAGES_TAR
105+
fi
106+
- uses: actions/setup-java@v4
107+
name: Setup JDK
24108
with:
25109
distribution: 'zulu'
26110
java-version: '17'
27-
- name: Run Build
28-
run: mvn -DskipTests clean package
29-
- name: Run Tests
111+
cache: 'maven'
112+
113+
- name: Run Tests (v${{ matrix.WEAVIATE_VERSION }})
30114
env:
31115
OKTA_DUMMY_CI_PW: ${{ secrets.OKTA_DUMMY_CI_PW }}
32116
WCS_DUMMY_CI_PW: ${{ secrets.WCS_DUMMY_CI_PW }}
33117
OKTA_CLIENT_SECRET: ${{ secrets.OKTA_CLIENT_SECRET }}
34118
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
35119
OPENAI_APIKEY: ${{ secrets.OPENAI_APIKEY }}
36-
run: mvn clean test
120+
WEAVIATE_VERSION: ${{ matrix.WEAVIATE_VERSION }}
121+
run: mvn verify -Dgpg.skip

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
target/
1212
# maven-lombok-plugin
1313
.factorypath
14+
# Surefire statistics for optimized execution time
15+
.surefire-*

pom.xml

Lines changed: 7 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
<maven.compiler.source>17</maven.compiler.source>
5353
<maven.compiler.target>17</maven.compiler.target>
5454
<maven.compiler.release>17</maven.compiler.release>
55-
<lombok.version>1.18.42</lombok.version>
5655
<gson.version>2.13.2</gson.version>
5756
<httpclient.version>5.5.1</httpclient.version>
5857
<lang3.version>3.19.0</lang3.version>
@@ -112,11 +111,6 @@
112111
<artifactId>httpclient5</artifactId>
113112
<version>${httpclient.version}</version>
114113
</dependency>
115-
<dependency>
116-
<groupId>org.projectlombok</groupId>
117-
<artifactId>lombok</artifactId>
118-
<version>${lombok.version}</version>
119-
</dependency>
120114
<dependency>
121115
<groupId>com.google.code.gson</groupId>
122116
<artifactId>gson</artifactId>
@@ -229,72 +223,17 @@
229223
</plugin>
230224
<plugin>
231225
<artifactId>maven-surefire-plugin</artifactId>
232-
<version>2.22.2</version>
226+
<version>3.5.4</version>
233227
<configuration>
234228
<trimStackTrace>false</trimStackTrace>
235-
<argLine>
236-
<!--
237-
Gson (used for JSON serialization) utilizes reflection and needs to be able to access private fields of
238-
Java core classes. For that to work correctly after Java 9, we need to open up some of the core Java
239-
classes to reflection.
240-
@see: https://www.oracle.com/corporate/features/understanding-java-9-modules.html
241-
-->
242-
--add-opens=java.base/java.lang=ALL-UNNAMED
243-
</argLine>
244-
<properties>
245-
<property>
246-
<name>listener</name>
247-
<value>io.weaviate.containers.TestListener</value>
248-
</property>
249-
</properties>
229+
<parallel>classes</parallel>
230+
<forkCount>4</forkCount>
231+
<reuseForks>true</reuseForks>
232+
<threadCount>1</threadCount>
233+
<perCoreThreadCount>true</perCoreThreadCount>
234+
<runOrder>balanced</runOrder>
250235
</configuration>
251236
</plugin>
252-
<plugin>
253-
<groupId>org.projectlombok</groupId>
254-
<artifactId>lombok-maven-plugin</artifactId>
255-
<version>1.18.20.0</version>
256-
<executions>
257-
<execution>
258-
<id>delombok-sources</id>
259-
<phase>generate-sources</phase>
260-
<goals>
261-
<goal>delombok</goal>
262-
</goals>
263-
<configuration>
264-
<sourceDirectory>src/main/java</sourceDirectory>
265-
<outputDirectory>${project.build.directory}/delombok</outputDirectory>
266-
<addOutputDirectory>false</addOutputDirectory>
267-
<encoding>UTF-8</encoding>
268-
</configuration>
269-
</execution>
270-
</executions>
271-
<dependencies>
272-
<dependency>
273-
<groupId>org.projectlombok</groupId>
274-
<artifactId>lombok</artifactId>
275-
<version>${lombok.version}</version>
276-
</dependency>
277-
</dependencies>
278-
</plugin>
279-
<plugin>
280-
<groupId>org.apache.maven.plugins</groupId>
281-
<artifactId>maven-antrun-plugin</artifactId>
282-
<version>3.0.0</version>
283-
<executions>
284-
<execution>
285-
<id>generate-delomboked-sources-jar</id>
286-
<phase>package</phase>
287-
<goals>
288-
<goal>run</goal>
289-
</goals>
290-
<configuration>
291-
<target>
292-
<jar destfile="${project.build.directory}/${project.build.finalName}-sources.jar" basedir="${project.build.directory}/delombok"/>
293-
</target>
294-
</configuration>
295-
</execution>
296-
</executions>
297-
</plugin>
298237
<plugin>
299238
<groupId>org.codehaus.mojo</groupId>
300239
<artifactId>versions-maven-plugin</artifactId>
@@ -317,22 +256,6 @@
317256
<artifactId>build-helper-maven-plugin</artifactId>
318257
<version>3.2.0</version>
319258
<executions>
320-
<execution>
321-
<id>attach-delomboked-sources-jar</id>
322-
<phase>package</phase>
323-
<goals>
324-
<goal>attach-artifact</goal>
325-
</goals>
326-
<configuration>
327-
<artifacts>
328-
<artifact>
329-
<file>${project.build.directory}/${project.build.finalName}-sources.jar</file>
330-
<type>jar</type>
331-
<classifier>sources</classifier>
332-
</artifact>
333-
</artifacts>
334-
</configuration>
335-
</execution>
336259
<execution>
337260
<id>add-test-source</id>
338261
<phase>generate-test-sources</phase>
@@ -384,7 +307,6 @@
384307
</execution>
385308
</executions>
386309
<configuration>
387-
<sourcepath>${project.build.directory}/delombok</sourcepath>
388310
<!--Disable warnings about missing docstrings.-->
389311
<doclint>all,-missing</doclint>
390312
</configuration>
@@ -512,10 +434,6 @@
512434
</plugins>
513435
</pluginManagement>
514436
<plugins>
515-
<plugin>
516-
<groupId>org.projectlombok</groupId>
517-
<artifactId>lombok-maven-plugin</artifactId>
518-
</plugin>
519437
<plugin>
520438
<groupId>org.xolstice.maven.plugins</groupId>
521439
<artifactId>protobuf-maven-plugin</artifactId>

src/it/java/io/weaviate/ConcurrentTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010

1111
import org.apache.commons.lang3.RandomStringUtils;
1212
import org.assertj.core.api.Assertions;
13+
import org.assertj.core.api.Assumptions;
1314
import org.junit.Rule;
1415
import org.junit.rules.TestName;
1516

17+
import io.weaviate.client6.v1.internal.VersionSupport.SemanticVersion;
18+
import io.weaviate.containers.Weaviate;
19+
1620
/**
1721
* ConcurrentTest is the base class for integration tests, which provides
1822
* utility methods to uniqualize collections and objects created in the
@@ -110,4 +114,22 @@ public static void eventually(Callable<Boolean> cond, int intervalMillis, int ti
110114
throw new RuntimeException(ex);
111115
}
112116
}
117+
118+
/**
119+
* Skip the test if the version that the {@link Weaviate}
120+
* container is running is older than the required one.
121+
*/
122+
public static void requireAtLeast(Weaviate.Version required) {
123+
var actual = SemanticVersion.of(Weaviate.VERSION);
124+
Assumptions.assumeThat(actual)
125+
.as("requires at least %s, but running %s", required.semver, actual)
126+
.isGreaterThanOrEqualTo(required.semver);
127+
}
128+
129+
public static void requireAtLeast(Weaviate.Version required, Runnable r) {
130+
var actual = SemanticVersion.of(Weaviate.VERSION);
131+
if (actual.compareTo(required.semver) >= 0) {
132+
r.run();
133+
}
134+
}
113135
}

src/it/java/io/weaviate/containers/Container.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ public class Container {
1818
public static final Img2VecNeural IMG2VEC_NEURAL = Img2VecNeural.createDefault();
1919
public static final MinIo MINIO = MinIo.createDefault();
2020

21-
/**
22-
* Stop all shared Testcontainers created in {@link #startAll}.
23-
* <p>
24-
* Testcontainer's Ryuk will reap any dangling containers after the tests
25-
* finish. However, since {@link Weaviate} instances also hold a
26-
* {@link WeaviateClient}, we want to stop them proactively to
27-
* close client connections.
28-
*/
29-
static void stopAll() {
30-
WEAVIATE.stop();
31-
}
32-
3321
public static ContainerGroup compose(Weaviate weaviate, GenericContainer<?>... containers) {
3422
return new ContainerGroup(weaviate, containers);
3523
}

src/it/java/io/weaviate/containers/TestListener.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)