depot/third_party/nixpkgs/nixos/tests/zram-generator.nix
Default email a0cb138ada Project import generated by Copybara.
GitOrigin-RevId: a100acd7bbf105915b0004427802286c37738fef
2023-02-02 18:25:31 +00:00

18 lines
549 B
Nix

import ./make-test-python.nix {
name = "zram-generator";
nodes.machine = { pkgs, ... }: {
environment.etc."systemd/zram-generator.conf".text = ''
[zram0]
zram-size = ram / 2
'';
systemd.packages = [ pkgs.zram-generator ];
systemd.services."systemd-zram-setup@".path = [ pkgs.util-linux ]; # for mkswap
};
testScript = ''
machine.wait_for_unit("systemd-zram-setup@zram0.service")
assert "zram0" in machine.succeed("zramctl -n")
assert "zram0" in machine.succeed("swapon --show --noheadings")
'';
}