lol

nixosTests.xscreensaver: migrate to runTest (#394998)

authored by

Pol Dellaiera and committed by
GitHub
0fc64a2b 8a2f45af

+76 -76
+1 -1
nixos/tests/all-tests.nix
··· 1337 1337 xpadneo = runTest ./xpadneo.nix; 1338 1338 xrdp = runTest ./xrdp.nix; 1339 1339 xrdp-with-audio-pulseaudio = runTest ./xrdp-with-audio-pulseaudio.nix; 1340 - xscreensaver = handleTest ./xscreensaver.nix {}; 1340 + xscreensaver = runTest ./xscreensaver.nix; 1341 1341 xss-lock = runTest ./xss-lock.nix; 1342 1342 xterm = runTest ./xterm.nix; 1343 1343 xxh = runTest ./xxh.nix;
+75 -75
nixos/tests/xscreensaver.nix
··· 1 - import ./make-test-python.nix ( 2 - { pkgs, lib, ... }: 3 - { 4 - name = "pass-secret-service"; 5 - meta.maintainers = with lib.maintainers; [ 6 - vancluever 7 - ]; 1 + { lib, ... }: 2 + { 3 + name = "pass-secret-service"; 4 + meta.maintainers = with lib.maintainers; [ 5 + vancluever 6 + ]; 8 7 9 - nodes = { 10 - ok = 11 - { nodes, pkgs, ... }: 12 - { 13 - imports = [ 14 - ./common/x11.nix 15 - ./common/user-account.nix 16 - ]; 17 - test-support.displayManager.auto.user = "alice"; 18 - services.xscreensaver.enable = true; 19 - }; 8 + node.pkgsReadOnly = false; 20 9 21 - empty_wrapperPrefix = 22 - { nodes, pkgs, ... }: 23 - { 24 - imports = [ 25 - ./common/x11.nix 26 - ./common/user-account.nix 27 - ]; 28 - test-support.displayManager.auto.user = "alice"; 29 - services.xscreensaver.enable = true; 30 - nixpkgs.overlays = [ 31 - (self: super: { 32 - xscreensaver = super.xscreensaver.override { 33 - wrapperPrefix = ""; 34 - }; 35 - }) 36 - ]; 37 - }; 10 + nodes = { 11 + ok = 12 + { nodes, pkgs, ... }: 13 + { 14 + imports = [ 15 + ./common/x11.nix 16 + ./common/user-account.nix 17 + ]; 18 + test-support.displayManager.auto.user = "alice"; 19 + services.xscreensaver.enable = true; 20 + }; 38 21 39 - bad_wrapperPrefix = 40 - { nodes, pkgs, ... }: 41 - { 42 - imports = [ 43 - ./common/x11.nix 44 - ./common/user-account.nix 45 - ]; 46 - test-support.displayManager.auto.user = "alice"; 47 - services.xscreensaver.enable = true; 48 - nixpkgs.overlays = [ 49 - (self: super: { 50 - xscreensaver = super.xscreensaver.override { 51 - wrapperPrefix = "/a/bad/path"; 52 - }; 53 - }) 54 - ]; 55 - }; 56 - }; 22 + empty_wrapperPrefix = 23 + { nodes, pkgs, ... }: 24 + { 25 + imports = [ 26 + ./common/x11.nix 27 + ./common/user-account.nix 28 + ]; 29 + test-support.displayManager.auto.user = "alice"; 30 + services.xscreensaver.enable = true; 31 + nixpkgs.overlays = [ 32 + (self: super: { 33 + xscreensaver = super.xscreensaver.override { 34 + wrapperPrefix = ""; 35 + }; 36 + }) 37 + ]; 38 + }; 57 39 58 - testScript = '' 59 - ok.wait_for_x() 60 - ok.wait_for_unit("xscreensaver", "alice") 61 - _, output_ok = ok.systemctl("status xscreensaver", "alice") 62 - assert 'To prevent the kernel from randomly unlocking' not in output_ok 63 - assert 'your screen via the out-of-memory killer' not in output_ok 64 - assert '"xscreensaver-auth" must be setuid root' not in output_ok 40 + bad_wrapperPrefix = 41 + { nodes, pkgs, ... }: 42 + { 43 + imports = [ 44 + ./common/x11.nix 45 + ./common/user-account.nix 46 + ]; 47 + test-support.displayManager.auto.user = "alice"; 48 + services.xscreensaver.enable = true; 49 + nixpkgs.overlays = [ 50 + (self: super: { 51 + xscreensaver = super.xscreensaver.override { 52 + wrapperPrefix = "/a/bad/path"; 53 + }; 54 + }) 55 + ]; 56 + }; 57 + }; 58 + 59 + testScript = '' 60 + ok.wait_for_x() 61 + ok.wait_for_unit("xscreensaver", "alice") 62 + _, output_ok = ok.systemctl("status xscreensaver", "alice") 63 + assert 'To prevent the kernel from randomly unlocking' not in output_ok 64 + assert 'your screen via the out-of-memory killer' not in output_ok 65 + assert '"xscreensaver-auth" must be setuid root' not in output_ok 65 66 66 - empty_wrapperPrefix.wait_for_x() 67 - empty_wrapperPrefix.wait_for_unit("xscreensaver", "alice") 68 - _, output_empty_wrapperPrefix = empty_wrapperPrefix.systemctl("status xscreensaver", "alice") 69 - assert 'To prevent the kernel from randomly unlocking' in output_empty_wrapperPrefix 70 - assert 'your screen via the out-of-memory killer' in output_empty_wrapperPrefix 71 - assert '"xscreensaver-auth" must be setuid root' in output_empty_wrapperPrefix 67 + empty_wrapperPrefix.wait_for_x() 68 + empty_wrapperPrefix.wait_for_unit("xscreensaver", "alice") 69 + _, output_empty_wrapperPrefix = empty_wrapperPrefix.systemctl("status xscreensaver", "alice") 70 + assert 'To prevent the kernel from randomly unlocking' in output_empty_wrapperPrefix 71 + assert 'your screen via the out-of-memory killer' in output_empty_wrapperPrefix 72 + assert '"xscreensaver-auth" must be setuid root' in output_empty_wrapperPrefix 72 73 73 - bad_wrapperPrefix.wait_for_x() 74 - bad_wrapperPrefix.wait_for_unit("xscreensaver", "alice") 75 - _, output_bad_wrapperPrefix = bad_wrapperPrefix.systemctl("status xscreensaver", "alice") 76 - assert 'To prevent the kernel from randomly unlocking' in output_bad_wrapperPrefix 77 - assert 'your screen via the out-of-memory killer' in output_bad_wrapperPrefix 78 - assert '"xscreensaver-auth" must be setuid root' in output_bad_wrapperPrefix 79 - ''; 80 - } 81 - ) 74 + bad_wrapperPrefix.wait_for_x() 75 + bad_wrapperPrefix.wait_for_unit("xscreensaver", "alice") 76 + _, output_bad_wrapperPrefix = bad_wrapperPrefix.systemctl("status xscreensaver", "alice") 77 + assert 'To prevent the kernel from randomly unlocking' in output_bad_wrapperPrefix 78 + assert 'your screen via the out-of-memory killer' in output_bad_wrapperPrefix 79 + assert '"xscreensaver-auth" must be setuid root' in output_bad_wrapperPrefix 80 + ''; 81 + }