Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion crates/validator/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,20 @@ pub(crate) async fn create_index(
client: &HttpClient,
table: &str,
column: &str,
options: Option<String>,
) -> IndexInfo {
let index = format!("idx_{}", Uuid::new_v4().simple());

let extra = if let Some(options) = options {
format!("WITH OPTIONS = {options}")
} else {
String::new()
};

// Create index
session
.query_unpaged(
format!("CREATE INDEX {index} ON {table}({column}) USING 'vector_index'"),
format!("CREATE INDEX {index} ON {table}({column}) USING 'vector_index' {extra}"),
(),
)
.await
Expand Down
6 changes: 3 additions & 3 deletions crates/validator/src/tests/ann.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async fn ann_query_returns_expected_results(actors: TestActors) {
.expect("failed to insert data");
}

let index = create_index(&session, &client, &table, "v").await;
let index = create_index(&session, &client, &table, "v", None).await;

wait_for(
|| async { client.count(&index.keyspace, &index.index).await == Some(1000) },
Expand Down Expand Up @@ -121,7 +121,7 @@ async fn ann_query_respects_limit(actors: TestActors) {
}

// Create index
let index = create_index(&session, &client, &table, "v").await;
let index = create_index(&session, &client, &table, "v", None).await;

wait_for(
|| async { client.count(&index.keyspace, &index.index).await == Some(10) },
Expand Down Expand Up @@ -189,7 +189,7 @@ async fn ann_query_respects_limit_over_1000_vectors(actors: TestActors) {
.expect("failed to insert data");
}

let index = create_index(&session, &client, &table, "v").await;
let index = create_index(&session, &client, &table, "v", None).await;

wait_for(
|| async { client.count(&index.keyspace, &index.index).await == Some(1111) },
Expand Down
6 changes: 3 additions & 3 deletions crates/validator/src/tests/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async fn simple_create_drop_index(actors: TestActors) {
)
.await;

let index = create_index(&session, &client, &table, "embedding").await;
let index = create_index(&session, &client, &table, "embedding", None).await;

assert_eq!(index.keyspace.as_ref(), &keyspace);

Expand Down Expand Up @@ -71,7 +71,7 @@ async fn simple_create_drop_multiple_indexes(actors: TestActors) {
.await;

// Create index on column v1
let index1 = create_index(&session, &client, &table, "v1").await;
let index1 = create_index(&session, &client, &table, "v1", None).await;

// Wait for the full scan to complete and check if ANN query succeeds on v1
wait_for(
Expand Down Expand Up @@ -99,7 +99,7 @@ async fn simple_create_drop_multiple_indexes(actors: TestActors) {
.expect_err("ANN query should fail when index does not exist");

// Create index on column v2
let index2 = create_index(&session, &client, &table, "v2").await;
let index2 = create_index(&session, &client, &table, "v2", None).await;

// Check if ANN query on v1 still succeeds
session
Expand Down
2 changes: 1 addition & 1 deletion crates/validator/src/tests/full_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn full_scan_is_completed_when_responding_to_messages_concurrently(actors:
.expect("failed to insert data");
}

let index = create_index(&session, &client, &table, "embedding").await;
let index = create_index(&session, &client, &table, "embedding", None).await;

let result = session
.query_unpaged(
Expand Down
2 changes: 2 additions & 0 deletions crates/validator/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod crud;
mod full_scan;
mod reconnect;
mod serde;
mod vector_similarity;

use crate::ServicesSubnet;
use crate::dns::Dns;
Expand Down Expand Up @@ -221,6 +222,7 @@ pub(crate) async fn register() -> Vec<(String, TestCase)> {
("full_scan", full_scan::new().await),
("reconnect", reconnect::new().await),
("serde", serde::new().await),
("vector_similarity", vector_similarity::new().await),
]
.into_iter()
.map(|(name, test_case)| (name.to_string(), test_case))
Expand Down
2 changes: 1 addition & 1 deletion crates/validator/src/tests/reconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async fn reconnect_doesnt_break_fullscan(actors: TestActors) {
.expect("failed to insert a row");
}

let index = create_index(&session, &client, &table, "embedding").await;
let index = create_index(&session, &client, &table, "embedding", None).await;

let result = session
.query_unpaged(
Expand Down
Loading
Loading