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
* chore: Change the dependency for supabase-wrappers to their repos 'main' branch in order to use the latest pgrx version
* feat: Add testing and a test to create a test foreign table
* feat,fix: Fix testcontainer startup and listening. Add test for insertion into table and select
* fix: More code reuse for testing
* chore: Add github action for building and testing
* fix: Fix test/build workflow. It doesn't do integration tests now
* feat: Add tests for all crud things currently supported
* fix: Remove unused/commented out code. Remove apt update from workflow
* fix: Run apt command as sudo
* fix: Add readline to the packages for apt to install
* feat: Add integration tests back in
let container = GenericImage::new("quay.io/coreos/etcd","v3.6.4")
464
+
.with_exposed_port(2379.tcp())
465
+
.with_wait_for(WaitFor::message_on_either_std(
466
+
"ready to serve client requests",
467
+
))
468
+
.with_privileged(true)
469
+
.with_cmd(CMD)
470
+
.with_startup_timeout(Duration::from_secs(90))
471
+
.start()
472
+
.expect("An etcd image was supposed to be started");
473
+
474
+
let host = container
475
+
.get_host()
476
+
.expect("Host-address should be available");
477
+
478
+
let port = container
479
+
.get_host_port_ipv4(2379.tcp())
480
+
.expect("Exposed host port should be available");
481
+
482
+
let url = format!("{}:{}", host, port);
483
+
(container, url)
484
+
}
485
+
486
+
fncreate_fdt(url:String) -> (){
487
+
Spi::run("CREATE FOREIGN DATA WRAPPER etcd_fdw handler etcd_fdw_handler validator etcd_fdw_validator;").expect("FDW should have been created");
488
+
489
+
// Create a server
490
+
Spi::run(
491
+
format!(
492
+
"CREATE SERVER etcd_test_server FOREIGN DATA WRAPPER etcd_fdw options(connstr '{}')",
493
+
url
494
+
)
495
+
.as_str(),
496
+
)
497
+
.expect("Server should have been created");
498
+
499
+
// Create a foreign table
500
+
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");
501
+
}
502
+
503
+
#[pg_test]
504
+
fntest_create_table(){
505
+
let(_container, url) = create_container();
506
+
507
+
create_fdt(url);
508
+
}
509
+
#[pg_test]
510
+
fntest_insert_select(){
511
+
let(_container, url) = create_container();
512
+
513
+
create_fdt(url);
514
+
515
+
// Insert into the foreign table
516
+
Spi::run("INSERT INTO test (key, value) VALUES ('foo','bar'),('bar','baz')")
517
+
.expect("INSERT should work");
518
+
519
+
let query_result = Spi::get_two::<String,String>("SELECT * FROM test WHERE key='foo'")
0 commit comments