diff --git a/libsql-server/tests/namespaces/meta.rs b/libsql-server/tests/namespaces/meta.rs index d79f3776f5..badb5e37a6 100644 --- a/libsql-server/tests/namespaces/meta.rs +++ b/libsql-server/tests/namespaces/meta.rs @@ -137,7 +137,43 @@ fn meta_store() { foo_conn.execute("select 1", ()).await.unwrap(); } - // STEP 4: try attaching a database + Ok(()) + }); + + sim.run().unwrap(); +} + +#[test] +fn meta_attach() { + let mut sim = Builder::new().build(); + let tmp = tempdir().unwrap(); + make_primary(&mut sim, tmp.path().to_path_buf()); + + sim.client("client", async { + let client = Client::new(); + + // STEP 1: create namespace and check that it can be read from + client + .post( + "http://primary:9090/v1/namespaces/foo/create", + json!({ + "max_db_size": "5mb" + }), + ) + .await?; + + { + let foo = Database::open_remote_with_connector( + "http://foo.primary:8080", + "", + TurmoilConnector, + )?; + let foo_conn = foo.connect()?; + + foo_conn.execute("select 1", ()).await.unwrap(); + } + + // STEP 2: try attaching a database { let foo = Database::open_remote_with_connector( "http://foo.primary:8080", @@ -149,7 +185,7 @@ fn meta_store() { foo_conn.execute("attach foo as foo", ()).await.unwrap_err(); } - // STEP 5: update config to allow attaching databases + // STEP 3: update config to allow attaching databases client .post( "http://primary:9090/v1/namespaces/foo/config",