X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Flib.rs;h=1852911a68a02b18e32bc7bc2a4a7c86d9b1b667;hb=708f1b0e90c421b8aa226362242290a34ccc2c1b;hp=f56aca260f218c0798df4b6ef2300c8534c4dcf5;hpb=a03d1c2f6391cedd9fc5951e8133f245aaacb582;p=rapid-gossip-sync-server diff --git a/src/lib.rs b/src/lib.rs index f56aca2..1852911 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,6 +41,9 @@ mod verifier; pub mod types; +#[cfg(test)] +mod tests; + /// The purpose of this prefix is to identify the serialization format, should other rapid gossip /// sync formats arise in the future. /// @@ -125,6 +128,14 @@ pub(crate) async fn connect_to_db() -> Client { } }); + #[cfg(test)] + { + let schema_name = tests::db_test_schema(); + let schema_creation_command = format!("CREATE SCHEMA IF NOT EXISTS {}", schema_name); + client.execute(&schema_creation_command, &[]).await.unwrap(); + client.execute(&format!("SET search_path TO {}", schema_name), &[]).await.unwrap(); + } + client.execute("set time zone UTC", &[]).await.unwrap(); client }