Skip to content

Commit 9e62e8a

Browse files
committed
validator/test: check VS cluster restart does not break setup
Add test restarting VS cluster and checking if the restart does not break ScyllaDB connection to VS nodes.
1 parent d71455f commit 9e62e8a

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

crates/validator-vector-store/src/reconnect.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ pub(crate) async fn new() -> TestCase {
3030
timeout,
3131
restarting_all_nodes_doesnt_break_fullscan,
3232
)
33+
.with_test(
34+
"restarting_vs_cluster_does_not_break_setup",
35+
timeout,
36+
test_restarting_vs_cluster_does_not_break_setup,
37+
)
3338
}
3439

3540
async fn reconnect_doesnt_break_fullscan(actors: TestActors) {
@@ -270,3 +275,58 @@ async fn restarting_all_nodes_doesnt_break_fullscan(actors: TestActors) {
270275

271276
info!("finished");
272277
}
278+
279+
async fn test_restarting_vs_cluster_does_not_break_setup(actors: TestActors) {
280+
info!("started");
281+
282+
let (session, clients) = prepare_connection(&actors).await;
283+
284+
let keyspace = create_keyspace(&session).await;
285+
let table = create_table(
286+
&session,
287+
"id INT PRIMARY KEY, embedding VECTOR<FLOAT, 3>",
288+
None,
289+
)
290+
.await;
291+
292+
let stmt = session
293+
.prepare(format!(
294+
"INSERT INTO {table} (id, embedding) VALUES (?, [1.0, 2.0, 3.0])"
295+
))
296+
.await
297+
.expect("failed to prepare a statement");
298+
299+
for id in 0..1000 {
300+
session
301+
.execute_unpaged(&stmt, (id,))
302+
.await
303+
.expect("failed to insert a row");
304+
}
305+
306+
let index = create_index(&session, &clients, &table, "embedding").await;
307+
308+
actors.vs.down().await;
309+
actors.vs.up(get_default_vs_node_configs(&actors)).await;
310+
311+
for client in &clients {
312+
let index_status = wait_for_index(client, &index).await;
313+
assert_eq!(
314+
index_status.count, 1000,
315+
"Expected 1000 vectors to be indexed"
316+
);
317+
}
318+
319+
session
320+
.query_unpaged(
321+
format!("SELECT * FROM {table} ORDER BY embedding ANN OF [1.0, 2.0, 3.0] LIMIT 5"),
322+
(),
323+
)
324+
.await
325+
.expect("failed to query ANN search");
326+
327+
session
328+
.query_unpaged(format!("DROP KEYSPACE {keyspace}"), ())
329+
.await
330+
.expect("failed to drop a keyspace");
331+
info!("finished");
332+
}

0 commit comments

Comments
 (0)