diff tests/systemd.rs @ 1:ef8bf41097ac

Added integration tests
author Martin Habovstiak <martin.habovstiak@gmail.com>
date Fri, 27 Nov 2020 10:07:35 +0100
parents
children 9731ff589d9c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/systemd.rs	Fri Nov 27 10:07:35 2020 +0100
@@ -0,0 +1,28 @@
+// This integration test requires presence of systemd-socket-activate
+
+use std::io;
+use std::ffi::OsStr;
+use std::process::{Command, Child};
+
+mod comm;
+
+enum Test {}
+
+impl comm::Test for Test {
+    const SOCKET_ADDR: &'static str = "systemd://secret_socket_of_satoshi_nakamoto";
+
+    fn spawn_slave(program_name: &OsStr) -> io::Result<Child> {
+        Command::new("systemd-socket-activate")
+            .arg("-l")
+            .arg("127.0.0.1:4242")
+            .arg("--fdname=secret_socket_of_satoshi_nakamoto")
+            .arg("--setenv=SYSTEMD_SOCKET_INTEGRATION_TEST=slave")
+            .arg(program_name)
+            .spawn()
+    }
+}
+
+#[test]
+fn main() {
+    comm::main::<Test>();
+}