@@ -137,7 +137,43 @@ fn meta_store() {
137
137
foo_conn. execute ( "select 1" , ( ) ) . await . unwrap ( ) ;
138
138
}
139
139
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
141
177
{
142
178
let foo = Database :: open_remote_with_connector (
143
179
"http://foo.primary:8080" ,
@@ -149,7 +185,7 @@ fn meta_store() {
149
185
foo_conn. execute ( "attach foo as foo" , ( ) ) . await . unwrap_err ( ) ;
150
186
}
151
187
152
- // STEP 5 : update config to allow attaching databases
188
+ // STEP 3 : update config to allow attaching databases
153
189
client
154
190
. post (
155
191
"http://primary:9090/v1/namespaces/foo/config" ,
0 commit comments