Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 88 additions & 88 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,103 +19,103 @@ jobs:
name: Cache shared Docker images
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: cache-check
uses: actions/cache/restore@v4
env:
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
with:
path: ${{ env.DOCKER_IMAGES_TAR }}
key: ${{ env.DOCKER_CACHE_KEY }}
lookup-only: true # Only check if cache exists, don't download
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false
- name: Pull images
if: steps.cache-check.outputs.cache-hit != 'true'
run: |
docker pull $IMG2VEC
docker pull $MINIO
# docker pull $MODEL2VEC
docker save $IMG2VEC $MINIO -o $DOCKER_IMAGES_TAR
- name: Cache images
if: steps.cache-check.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
env:
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
with:
path: ${{ env.DOCKER_IMAGES_TAR }}
key: ${{ env.DOCKER_CACHE_KEY }}
- name: Login to Docker Hub
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: cache-check
uses: actions/cache/restore@v4
env:
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
with:
path: ${{ env.DOCKER_IMAGES_TAR }}
key: ${{ env.DOCKER_CACHE_KEY }}
lookup-only: true # Only check if cache exists, don't download
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false
- name: Pull images
if: steps.cache-check.outputs.cache-hit != 'true'
run: |
docker pull $IMG2VEC
docker pull $MINIO
# docker pull $MODEL2VEC
docker save $IMG2VEC $MINIO -o $DOCKER_IMAGES_TAR
- name: Cache images
if: steps.cache-check.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
env:
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
with:
path: ${{ env.DOCKER_IMAGES_TAR }}
key: ${{ env.DOCKER_CACHE_KEY }}

maven-cache:
name: Cache Maven dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'maven'
- run: mvn dependency:go-offline
name: Cache Maven dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
cache: "maven"
- run: mvn dependency:go-offline

test:
name: Test
runs-on: ubuntu-latest
needs: [ docker-cache, maven-cache]
needs: [docker-cache, maven-cache]
strategy:
fail-fast: false
matrix:
WEAVIATE_VERSION: ["1.32.16", "1.33.4", "1.34.0"]
WEAVIATE_VERSION: ["1.32.24", "1.33.11", "1.34.7", "1.35.2"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/cache/restore@v4
env:
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
with:
path: ${{ env.DOCKER_IMAGES_TAR }}
key: ${{ env.DOCKER_CACHE_KEY }}
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false
- name: Load Docker images
run: |
if [ -f $DOCKER_IMAGES_TAR ]; then
docker load -i $DOCKER_IMAGES_TAR
fi
- uses: actions/setup-java@v4
name: Setup JDK
with:
distribution: 'zulu'
java-version: '17'
cache: 'maven'
- uses: actions/cache/restore@v4
env:
DOCKER_CACHE_KEY: docker-images-${{ env.IMG2VEC }}-${{ env.MINIO }}-${{ env.MODEL2VEC }}
with:
path: ${{ env.DOCKER_IMAGES_TAR }}
key: ${{ env.DOCKER_CACHE_KEY }}
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false
- name: Load Docker images
run: |
if [ -f $DOCKER_IMAGES_TAR ]; then
docker load -i $DOCKER_IMAGES_TAR
fi
- uses: actions/setup-java@v4
name: Setup JDK
with:
distribution: "zulu"
java-version: "17"
cache: "maven"

- name: Run Tests (v${{ matrix.WEAVIATE_VERSION }})
env:
OKTA_DUMMY_CI_PW: ${{ secrets.OKTA_DUMMY_CI_PW }}
WCS_DUMMY_CI_PW: ${{ secrets.WCS_DUMMY_CI_PW }}
OKTA_CLIENT_SECRET: ${{ secrets.OKTA_CLIENT_SECRET }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
OPENAI_APIKEY: ${{ secrets.OPENAI_APIKEY }}
WEAVIATE_VERSION: ${{ matrix.WEAVIATE_VERSION }}
run: mvn verify -Dgpg.skip
- name: Run Tests (v${{ matrix.WEAVIATE_VERSION }})
env:
OKTA_DUMMY_CI_PW: ${{ secrets.OKTA_DUMMY_CI_PW }}
WCS_DUMMY_CI_PW: ${{ secrets.WCS_DUMMY_CI_PW }}
OKTA_CLIENT_SECRET: ${{ secrets.OKTA_CLIENT_SECRET }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
OPENAI_APIKEY: ${{ secrets.OPENAI_APIKEY }}
WEAVIATE_VERSION: ${{ matrix.WEAVIATE_VERSION }}
run: mvn verify -Dgpg.skip
9 changes: 5 additions & 4 deletions src/it/java/io/weaviate/containers/Weaviate.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class Weaviate extends WeaviateContainer {
public static final String DOCKER_IMAGE = "semitechnologies/weaviate";
public static final String LATEST_VERSION = Version.V134.semver.toString();
public static final String LATEST_VERSION = Version.V135.semver.toString();
public static final String VERSION;

static {
Expand All @@ -38,9 +38,10 @@ public class Weaviate extends WeaviateContainer {
private final String containerName;

public enum Version {
V132(1, 32, 16),
V133(1, 33, 4),
V134(1, 34, 0);
V132(1, 32, 24),
V133(1, 33, 11),
V134(1, 34, 7),
V135(1, 35, 2);

public final SemanticVersion semver;

Expand Down
53 changes: 53 additions & 0 deletions src/it/java/io/weaviate/integration/CollectionsITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.weaviate.client6.v1.api.collections.DataType;
import io.weaviate.client6.v1.api.collections.Generative;
import io.weaviate.client6.v1.api.collections.InvertedIndex;
import io.weaviate.client6.v1.api.collections.ObjectTtl;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.Quantization;
import io.weaviate.client6.v1.api.collections.ReferenceProperty;
Expand All @@ -21,6 +22,7 @@
import io.weaviate.client6.v1.api.collections.config.Shard;
import io.weaviate.client6.v1.api.collections.config.ShardStatus;
import io.weaviate.client6.v1.api.collections.generative.DummyGenerative;
import io.weaviate.client6.v1.api.collections.query.BaseQueryOptions;
import io.weaviate.client6.v1.api.collections.vectorindex.Hnsw;
import io.weaviate.client6.v1.api.collections.vectorizers.SelfProvidedVectorizer;
import io.weaviate.containers.Container;
Expand Down Expand Up @@ -275,4 +277,55 @@ public void test_updateGenerative() throws IOException {
.extracting(CollectionConfig::generativeModule).isNotNull()
.returns(Generative.Kind.DUMMY, Generative::_kind);
}

@Test
public void test_objectTtl() throws IOException {
Weaviate.Version.V135.orSkip();

// Arrange
var nsThings = ns("Things");

// Act: create collection
var things = client.collections.create(nsThings,
c -> c.objectTtl(ttl -> ttl
.deleteByCreationTime()
.defaultTtlSeconds(120)));

// Assert: correct Object TTL config
var created = things.config.get();

Assertions.assertThat(created).get()
.as("created collection")
.extracting(CollectionConfig::objectTtl).isNotNull()
.returns(true, ObjectTtl::enabled)
.returns(BaseQueryOptions.CREATION_TIME_PROPERTY, ObjectTtl::deleteOn)
.returns(120, ObjectTtl::defaultTtlSeconds);

// Act: update TTL config
things.config.update(
c -> c.objectTtl(ttl -> ttl
.deleteByUpdateTime()
.defaultTtlSeconds(400)));

// Assert: correct Object TTL config
var updated = things.config.get();

Assertions.assertThat(updated).get()
.as("updated collection")
.extracting(CollectionConfig::objectTtl).isNotNull()
.returns(true, ObjectTtl::enabled)
.returns(BaseQueryOptions.LAST_UPDATE_TIME_PROPERTY, ObjectTtl::deleteOn)
.returns(400, ObjectTtl::defaultTtlSeconds);

// Act: disable TTL config
things.config.update(c -> c.objectTtl(ttl -> ttl.enabled(false)));

// Assert: correct Object TTL config
var disabled = things.config.get();

Assertions.assertThat(disabled).get()
.as("disabled object TTL")
.extracting(CollectionConfig::objectTtl).isNotNull()
.returns(false, ObjectTtl::enabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public record CollectionConfig(
@SerializedName("replicationConfig") Replication replication,
/** Inverted index configuration. */
@SerializedName("invertedIndexConfig") InvertedIndex invertedIndex,
@SerializedName("objectTtlConfig") ObjectTtl objectTtl,
/** Reranker modules. */
List<Reranker> rerankerModules,
/** Generative modules. */
Expand Down Expand Up @@ -68,6 +69,7 @@ public Builder edit() {
.sharding(sharding)
.replication(replication)
.invertedIndex(invertedIndex)
.objectTtl(objectTtl)
.rerankerModules(rerankerModules != null ? rerankerModules : new ArrayList<>())
.generativeModule(generativeModule);
}
Expand All @@ -88,6 +90,7 @@ public CollectionConfig(Builder builder) {
builder.sharding,
builder.replication,
builder.invertedIndex,
builder.objectTtl,
builder.rerankerModules,
builder.generativeModule);
}
Expand All @@ -104,6 +107,7 @@ public static class Builder implements ObjectBuilder<CollectionConfig> {
private Sharding sharding;
private Replication replication;
private InvertedIndex invertedIndex;
private ObjectTtl objectTtl;
private List<Reranker> rerankerModules = new ArrayList<>();
private Generative generativeModule;

Expand Down Expand Up @@ -188,7 +192,7 @@ public Builder sharding(Sharding sharding) {

/** Configure collection's sharding. */
public Builder sharding(Function<Sharding.Builder, ObjectBuilder<Sharding>> fn) {
this.sharding = Sharding.of(fn);
this.sharding(Sharding.of(fn));
return this;
}

Expand All @@ -211,7 +215,7 @@ public Builder replication(Replication replication) {

/** Configure replication. */
public Builder replication(Function<Replication.Builder, ObjectBuilder<Replication>> fn) {
this.replication = Replication.of(fn);
this.replication(Replication.of(fn));
return this;
}

Expand All @@ -223,7 +227,19 @@ public Builder invertedIndex(InvertedIndex invertedIndex) {

/** Change inverted index configurations. */
public Builder invertedIndex(Function<InvertedIndex.Builder, ObjectBuilder<InvertedIndex>> fn) {
this.invertedIndex = InvertedIndex.of(fn);
this.invertedIndex(InvertedIndex.of(fn));
return this;
}

/** Change inverted index configurations. */
public Builder objectTtl(ObjectTtl objectTtl) {
this.objectTtl = objectTtl;
return this;
}

/** Change object TTL configuration. */
public Builder objectTtl(Function<ObjectTtl.Builder, ObjectBuilder<ObjectTtl>> fn) {
this.objectTtl(ObjectTtl.of(fn));
return this;
}

Expand Down
Loading
Loading