Skip to content

Commit 32d72e5

Browse files
committed
add simple test
1 parent 4c223c7 commit 32d72e5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

libsql-server/tests/hrana/batch.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,26 @@ fn reindex_statement() {
379379

380380
sim.run().unwrap();
381381
}
382+
383+
#[test]
384+
fn test_simulate_vector_index_load_from_dump() {
385+
let mut sim = turmoil::Builder::new()
386+
.simulation_duration(Duration::from_secs(1000))
387+
.build();
388+
sim.host("primary", super::make_standalone_server);
389+
sim.client("client", async {
390+
let db = Database::open_remote_with_connector("http://primary:8080", "", TurmoilConnector)?;
391+
let conn = db.connect()?;
392+
393+
conn.execute("CREATE TABLE t ( v FLOAT32(2) );", ()).await?;
394+
conn.execute("CREATE TABLE t_idx_shadow(index_key INTEGER , data BLOB, PRIMARY KEY (index_key));", ()).await?;
395+
conn.execute("CREATE TABLE libsql_vector_meta_shadow ( name TEXT PRIMARY KEY, metadata BLOB ) WITHOUT ROWID", ()).await?;
396+
conn.execute("INSERT INTO libsql_vector_meta_shadow VALUES ('t_idx', x'');", ()).await?;
397+
conn.execute("INSERT INTO t VALUES (vector('[1,2]')), (vector('[2,3]'));", ()).await?;
398+
conn.execute("CREATE INDEX t_idx ON t (libsql_vector_idx(v));", ()).await?;
399+
400+
Ok(())
401+
});
402+
403+
sim.run().unwrap();
404+
}

0 commit comments

Comments
 (0)