You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let container = GenericImage::new("quay.io/coreos/etcd","v3.6.4")
327
326
.with_exposed_port(2379.tcp())
328
327
.with_wait_for(WaitFor::message_on_either_std(
@@ -343,9 +342,10 @@ mod tests {
343
342
.expect("Exposed host port should be available");
344
343
345
344
let url = format!("{}:{}", host, port);
346
-
dbg!("Testing FDW on container at {}",&url);
345
+
(container, url)
346
+
}
347
347
348
-
// Create our fdw
348
+
fncreate_fdt(url:String) -> (){
349
349
Spi::run("CREATE FOREIGN DATA WRAPPER etcd_fdw handler etcd_fdw_handler validator etcd_fdw_validator;").expect("FDW should have been created");
350
350
351
351
// Create a server
@@ -361,45 +361,18 @@ mod tests {
361
361
// Create a foreign table
362
362
Spi::run("CREATE FOREIGN TABLE test (key text, value text) server etcd_test_server options (rowid_column 'key')").expect("Test table should have been created");
363
363
}
364
-
#[pg_test]
365
-
fntest_insert_select(){
366
-
let container = GenericImage::new("quay.io/coreos/etcd","v3.6.4")
367
-
.with_exposed_port(2379.tcp())
368
-
.with_wait_for(WaitFor::message_on_either_std(
369
-
"ready to serve client requests",
370
-
))
371
-
.with_cmd(CMD)
372
-
.with_privileged(true)
373
-
.with_startup_timeout(Duration::from_secs(90))
374
-
.start()
375
-
.expect("An etcd image was supposed to be started");
376
-
377
-
let host = container
378
-
.get_host()
379
-
.expect("Host-address should be available");
380
-
381
-
let port = container
382
-
.get_host_port_ipv4(2379.tcp())
383
-
.expect("Exposed host port should be available");
384
-
385
-
let url = format!("{}:{}", host, port);
386
-
dbg!("Testing FDW on container at {}",&url);
387
364
388
-
// Create our fdw
389
-
Spi::run("CREATE FOREIGN DATA WRAPPER etcd_fdw handler etcd_fdw_handler validator etcd_fdw_validator;").expect("FDW should have been created");
365
+
#[pg_test]
366
+
fntest_create_table(){
367
+
let(_container, url) = create_container();
390
368
391
-
// Create a server
392
-
Spi::run(
393
-
format!(
394
-
"CREATE SERVER etcd_test_server FOREIGN DATA WRAPPER etcd_fdw options(connstr '{}')",
395
-
url
396
-
)
397
-
.as_str(),
398
-
)
399
-
.expect("Server should have been created");
369
+
create_fdt(url);
370
+
}
371
+
#[pg_test]
372
+
fntest_insert_select(){
373
+
let(_container, url) = create_container();
400
374
401
-
// Create a foreign table
402
-
Spi::run("CREATE FOREIGN TABLE test (key text, value text) server etcd_test_server options (rowid_column 'key')").expect("Test table should have been created");
375
+
create_fdt(url);
403
376
404
377
// Insert into the foreign table
405
378
Spi::run("INSERT INTO test (key, value) VALUES ('foo','bar'),('bar','baz')")
0 commit comments