use foundationdb::api::FdbApiBuilder;
use std::thread;
#[test]
#[should_panic(expected = "the fdb select api version can only be run once per process")]
fn test_run() {
let (runner, cond) = FdbApiBuilder::default()
.build()
.expect("could not initialize api")
.build()
.expect("could not initialize network");
let net_thread = thread::spawn(move || {
unsafe { runner.run() }.expect("failed to run");
});
let stopper = cond.wait();
stopper.stop().expect("failed to stop");
net_thread.join().expect("failed to join net thread");
println!("stopped!");
let _ = FdbApiBuilder::default().build();
panic!("previous line should have panicked!");
}