nixos/tests: fix some evaluation errors

Fixes errors caught by "nixos/testing: restrict arguments to makeTest" as
well as some unrelated errors and warnings.
This commit is contained in:
Naïm Favier 2022-03-18 01:27:04 +01:00
parent 79a234567c
commit ca8c877f8c
No known key found for this signature in database
GPG key ID: 49B07322580B7EE2
12 changed files with 43 additions and 59 deletions

View file

@ -38,7 +38,6 @@ let
} // extraConfig); } // extraConfig);
in in
makeTest { makeTest {
inherit iso;
name = "boot-" + name; name = "boot-" + name;
nodes = { }; nodes = { };
testScript = testScript =

View file

@ -7,7 +7,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
nodes = { nodes = {
webserver = { pkgs, lib, ... }: { webserver = { pkgs, lib, ... }: {
services.caddy.enable = true; services.caddy.enable = true;
services.caddy.config = '' services.caddy.extraConfig = ''
http://localhost { http://localhost {
encode gzip encode gzip
@ -22,7 +22,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
''; '';
specialisation.etag.configuration = { specialisation.etag.configuration = {
services.caddy.config = lib.mkForce '' services.caddy.extraConfig = lib.mkForce ''
http://localhost { http://localhost {
encode gzip encode gzip
@ -38,7 +38,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
}; };
specialisation.config-reload.configuration = { specialisation.config-reload.configuration = {
services.caddy.config = '' services.caddy.extraConfig = ''
http://localhost:8080 { http://localhost:8080 {
} }
''; '';

View file

@ -48,7 +48,7 @@ let
sudo sudo
ceph ceph
xfsprogs xfsprogs
netcat-openbsd libressl.nc
]; ];
boot.kernelModules = [ "xfs" ]; boot.kernelModules = [ "xfs" ];

View file

@ -15,26 +15,9 @@
with import ../lib/testing-python.nix { inherit system pkgs; }; with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
mapAttrs (channel: chromiumPkg: makeTest rec { let
name = "chromium-${channel}";
meta = {
maintainers = with maintainers; [ aszlig primeos ];
# https://github.com/NixOS/hydra/issues/591#issuecomment-435125621
inherit (chromiumPkg.meta) timeout;
};
enableOCR = true;
user = "alice"; user = "alice";
machine.imports = [ ./common/user-account.nix ./common/x11.nix ];
machine.virtualisation.memorySize = 2047;
machine.test-support.displayManager.auto.user = user;
machine.environment = {
systemPackages = [ chromiumPkg ];
variables."XAUTHORITY" = "/home/alice/.Xauthority";
};
startupHTML = pkgs.writeText "chromium-startup.html" '' startupHTML = pkgs.writeText "chromium-startup.html" ''
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -50,6 +33,25 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
</body> </body>
</html> </html>
''; '';
in
mapAttrs (channel: chromiumPkg: makeTest {
name = "chromium-${channel}";
meta = {
maintainers = with maintainers; [ aszlig primeos ];
# https://github.com/NixOS/hydra/issues/591#issuecomment-435125621
inherit (chromiumPkg.meta) timeout;
};
enableOCR = true;
machine.imports = [ ./common/user-account.nix ./common/x11.nix ];
machine.virtualisation.memorySize = 2047;
machine.test-support.displayManager.auto.user = user;
machine.environment = {
systemPackages = [ chromiumPkg ];
variables."XAUTHORITY" = "/home/alice/.Xauthority";
};
testScript = let testScript = let
xdo = name: text: let xdo = name: text: let

View file

@ -1,7 +1,7 @@
# This test runs CRI-O and verifies via critest # This test runs CRI-O and verifies via critest
import ./make-test-python.nix ({ pkgs, ... }: { import ./make-test-python.nix ({ pkgs, ... }: {
name = "cri-o"; name = "cri-o";
maintainers = with pkgs.lib.maintainers; teams.podman.members; meta.maintainers = with pkgs.lib.maintainers; teams.podman.members;
nodes = { nodes = {
crio = { crio = {

View file

@ -20,7 +20,7 @@ import ./make-test-python.nix (
nodes = { nodes = {
server = server =
{ ... }: { config, ... }:
{ {
networking.firewall.allowedTCPPorts = [ 80 ]; networking.firewall.allowedTCPPorts = [ 80 ];

View file

@ -21,9 +21,9 @@ import ./make-test-python.nix ({ pkgs, ... }: {
forceSSL = true; forceSSL = true;
}; };
security.acme.email = "me@example.org";
security.acme.acceptTerms = true; security.acme.acceptTerms = true;
security.acme.server = "https://example.com"; # self-signed only security.acme.defaults.email = "me@example.org";
security.acme.defaults.server = "https://example.com"; # self-signed only
}; };
}; };

View file

@ -1,13 +1,13 @@
# Miscellaneous small tests that don't warrant their own VM run. # Miscellaneous small tests that don't warrant their own VM run.
import ./make-test-python.nix ({ pkgs, ...} : rec { import ./make-test-python.nix ({ pkgs, ...} : let
foo = pkgs.writeText "foo" "Hello World";
in {
name = "misc"; name = "misc";
meta = with pkgs.lib.maintainers; { meta = with pkgs.lib.maintainers; {
maintainers = [ eelco ]; maintainers = [ eelco ];
}; };
foo = pkgs.writeText "foo" "Hello World";
machine = machine =
{ lib, ... }: { lib, ... }:
with lib; with lib;

View file

@ -14,12 +14,6 @@ import ./make-test-python.nix ({ pkgs, ... }:
}; };
}; };
users.testuser = {
uid = 1000;
group = "testgroup";
};
groups.testgroup.gid = 1000;
testScript = '' testScript = ''
machine.wait_for_unit("rstudio-server.service") machine.wait_for_unit("rstudio-server.service")
machine.succeed("curl -f -vvv -s http://127.0.0.1:8787") machine.succeed("curl -f -vvv -s http://127.0.0.1:8787")

View file

@ -42,8 +42,8 @@ import ./make-test-python.nix ({ pkgs, ... }:
caclient = caclient =
{ config, pkgs, ... }: { { config, pkgs, ... }: {
security.acme.server = "https://caserver:8443/acme/acme/directory"; security.acme.defaults.server = "https://caserver:8443/acme/acme/directory";
security.acme.email = "root@example.org"; security.acme.defaults.email = "root@example.org";
security.acme.acceptTerms = true; security.acme.acceptTerms = true;
security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ]; security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ];

View file

@ -1,19 +1,14 @@
import ./make-test-python.nix ({ lib, ... }: with lib; import ./make-test-python.nix ({ lib, ... }: with lib;
rec { {
name = "tor"; name = "tor";
meta.maintainers = with maintainers; [ joachifm ]; meta.maintainers = with maintainers; [ joachifm ];
common = nodes.client = { pkgs, ... }: {
{ ... }: boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
{ boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
networking.firewall.enable = false; networking.firewall.enable = false;
networking.useDHCP = false; networking.useDHCP = false;
};
nodes.client =
{ pkgs, ... }:
{ imports = [ common ];
environment.systemPackages = with pkgs; [ netcat ]; environment.systemPackages = with pkgs; [ netcat ];
services.tor.enable = true; services.tor.enable = true;
services.tor.client.enable = true; services.tor.client.enable = true;

View file

@ -4,12 +4,6 @@ import ./make-test-python.nix ({ lib, ... }: {
maintainers = [ ericson2314 ]; maintainers = [ ericson2314 ];
}; };
nixpkgs.overlays = [
(self: super: {
nix = throw "don't want to use this";
})
];
nodes.machine = { ... }: { nodes.machine = { ... }: {
nix.enable = false; nix.enable = false;
}; };