about summary refs log tree commit diff
path: root/tests/groups.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/groups.rs')
-rw-r--r--tests/groups.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/groups.rs b/tests/groups.rs
index 3966ac4..d9aba36 100644
--- a/tests/groups.rs
+++ b/tests/groups.rs
@@ -4,19 +4,16 @@ use http_body_util::BodyExt;
 use serde_json::Value;
 use tower::ServiceExt;
 
+mod common;
+
 /// Needs a live MariaDB connection (SQL_URI, see src/db.rs); skips rather
 /// than fails when none is reachable, same as species.rs. BXD is used
 /// everywhere as a test fixture in the GeneNetwork2/GeneNetwork3 test
 /// suites and is always present in the database.
 #[tokio::test]
 async fn groups_returns_ok_with_bxd() {
-    if std::net::TcpStream::connect_timeout(
-        &"127.0.0.1:3306".parse().unwrap(),
-        std::time::Duration::from_millis(500),
-    )
-    .is_err()
-    {
-        eprintln!("skipping groups_returns_ok_with_bxd: no database on 127.0.0.1:3306");
+    if !common::db_available() {
+        eprintln!("skipping groups_returns_ok_with_bxd: no usable database (check SQL_URI credentials)");
         return;
     }