Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/system-manager-engine/src/activate/etc_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn list_static_entries(config_entries: &EtcFilesConfig) -> anyhow::Result<Vec<Et
source: StorePath {
store_path: canon_path,
},
target: PathBuf::from("/etc").join(target),
target,
uid: 0,
gid: 0,
group: "".to_string(),
Expand Down
45 changes: 45 additions & 0 deletions testFlake/container-tests/check-ephemeral-flag.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
forEachDistro,
system,
system-manager-v1-1-0,
...
}:

forEachDistro "check-ephemeral-flag" {
modules = [
{
environment.etc = {
"a/bar" = {
text = "bar";
mode = "0700";
user = "root";
group = "root";
};
};
}
];
testScriptFunction =
{ toplevel, hostPkgs, ... }:
''
# Start the container
start_all()

# Wait for systemd to be ready
machine.wait_for_unit("multi-user.target")

def check_file(path, content):
file = machine.file(path)
assert file.exists, f"{path} should exist"
assert file.is_file, f"{path} should be a file"
assert file.contains(content), f"{path} should contain {content}"

# Let's activate the profile with a v0 state file (using an old system-manager checkout)
activation_logs = machine.succeed("${toplevel}/bin/activate --ephemeral")
for line in activation_logs.split("\n"):
assert not "ERROR" in line, line
machine.wait_for_unit("system-manager.target")

with subtest("Verify correct files are created"):
check_file("/run/etc/a/bar", "bar")
'';
}