blob: 6a86bc500e69200aa16b539733a3099924b8cdd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
use std::path::Path;
#[test]
fn docker_override_exists_and_valid() {
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/systemd/docker.conf");
assert!(path.exists(), "docker.conf template missing");
let content = std::fs::read_to_string(&path).unwrap();
assert!(
content.contains("SupplementaryGroups=docker"),
"docker.conf must grant docker group"
);
assert!(
content.contains("ReadWritePaths=/var/run/docker.sock"),
"docker.conf must allow docker socket access"
);
assert!(
content.contains("[Service]"),
"docker.conf must be a systemd unit override"
);
}
#[test]
fn podman_override_exists_and_valid() {
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/systemd/podman.conf");
assert!(path.exists(), "podman.conf template missing");
let content = std::fs::read_to_string(&path).unwrap();
assert!(
content.contains("RestrictNamespaces=no"),
"podman.conf must disable RestrictNamespaces"
);
assert!(
content.contains("XDG_RUNTIME_DIR=/run/user/%U"),
"podman.conf must set XDG_RUNTIME_DIR with %U"
);
assert!(
content.contains("[Service]"),
"podman.conf must be a systemd unit override"
);
}
#[test]
fn override_templates_are_not_empty() {
let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/systemd");
for name in ["docker.conf", "podman.conf"] {
let path = dir.join(name);
let meta = std::fs::metadata(&path).unwrap();
assert!(meta.len() > 0, "{name} must not be empty");
}
}
|