1 import ./make-test-python.nix (
58 "PrivateUsersOwnership"
64 "VirtualEthernetExtra"
73 optionsToConfig = opts: builtins.listToAttrs (map (n: lib.nameValuePair n "testdata") opts);
75 grepForOptions = opts: ''
77 "for o in ${builtins.concatStringsSep " " opts} ; do grep --quiet $o ${configFile} || exit 1 ; done"
80 unitName = "options-test";
81 configFile = "/etc/systemd/nspawn/${unitName}.nspawn";
85 name = "systemd-nspawn-configfile";
91 systemd.nspawn."${unitName}" = {
94 execConfig = optionsToConfig execOptions // {
100 filesConfig = optionsToConfig filesOptions // {
103 PrivateUsersChown = true;
104 PrivateUsersOwnership = "auto";
107 networkConfig = optionsToConfig networkOptions // {
109 VirtualEthernet = true;
118 node.wait_for_file("${configFile}")
120 with subtest("Test for presence of all specified options in config file"):
121 ${grepForOptions execOptions}
122 ${grepForOptions filesOptions}
123 ${grepForOptions networkOptions}
125 with subtest("Test for absence of misspelled option 'MachineId' (instead of 'MachineID')"):
126 node.fail("grep --quiet MachineId ${configFile}")
130 lib.maintainers.zi3m5f