Mercurial > crates > systemd-socket
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 0:a65053246c29 | 1:ef8bf41097ac |
|---|---|
| 1 // This integration test requires presence of systemd-socket-activate | |
| 2 | |
| 3 use std::io; | |
| 4 use std::ffi::OsStr; | |
| 5 use std::process::{Command, Child}; | |
| 6 | |
| 7 mod comm; | |
| 8 | |
| 9 enum Test {} | |
| 10 | |
| 11 impl comm::Test for Test { | |
| 12 const SOCKET_ADDR: &'static str = "systemd://secret_socket_of_satoshi_nakamoto"; | |
| 13 | |
| 14 fn spawn_slave(program_name: &OsStr) -> io::Result<Child> { | |
| 15 Command::new("systemd-socket-activate") | |
| 16 .arg("-l") | |
| 17 .arg("127.0.0.1:4242") | |
| 18 .arg("--fdname=secret_socket_of_satoshi_nakamoto") | |
| 19 .arg("--setenv=SYSTEMD_SOCKET_INTEGRATION_TEST=slave") | |
| 20 .arg(program_name) | |
| 21 .spawn() | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 #[test] | |
| 26 fn main() { | |
| 27 comm::main::<Test>(); | |
| 28 } |
