@@ -137,7 +137,43 @@ fn meta_store() {
137137 foo_conn. execute ( "select 1" , ( ) ) . await . unwrap ( ) ;
138138 }
139139
140- // STEP 4: try attaching a database
140+ Ok ( ( ) )
141+ } ) ;
142+
143+ sim. run ( ) . unwrap ( ) ;
144+ }
145+
146+ #[ test]
147+ fn meta_attach ( ) {
148+ let mut sim = Builder :: new ( ) . build ( ) ;
149+ let tmp = tempdir ( ) . unwrap ( ) ;
150+ make_primary ( & mut sim, tmp. path ( ) . to_path_buf ( ) ) ;
151+
152+ sim. client ( "client" , async {
153+ let client = Client :: new ( ) ;
154+
155+ // STEP 1: create namespace and check that it can be read from
156+ client
157+ . post (
158+ "http://primary:9090/v1/namespaces/foo/create" ,
159+ json ! ( {
160+ "max_db_size" : "5mb"
161+ } ) ,
162+ )
163+ . await ?;
164+
165+ {
166+ let foo = Database :: open_remote_with_connector (
167+ "http://foo.primary:8080" ,
168+ "" ,
169+ TurmoilConnector ,
170+ ) ?;
171+ let foo_conn = foo. connect ( ) ?;
172+
173+ foo_conn. execute ( "select 1" , ( ) ) . await . unwrap ( ) ;
174+ }
175+
176+ // STEP 2: try attaching a database
141177 {
142178 let foo = Database :: open_remote_with_connector (
143179 "http://foo.primary:8080" ,
@@ -149,7 +185,7 @@ fn meta_store() {
149185 foo_conn. execute ( "attach foo as foo" , ( ) ) . await . unwrap_err ( ) ;
150186 }
151187
152- // STEP 5 : update config to allow attaching databases
188+ // STEP 3 : update config to allow attaching databases
153189 client
154190 . post (
155191 "http://primary:9090/v1/namespaces/foo/config" ,
0 commit comments