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);
in
makeTest {
inherit iso;
name = "boot-" + name;
nodes = { };
testScript =

View File

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

View File

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

View File

@ -15,26 +15,9 @@
with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
mapAttrs (channel: chromiumPkg: makeTest rec {
name = "chromium-${channel}";
meta = {
maintainers = with maintainers; [ aszlig primeos ];
# https://github.com/NixOS/hydra/issues/591#issuecomment-435125621
inherit (chromiumPkg.meta) timeout;
};
enableOCR = true;
let
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" ''
<!DOCTYPE html>
<html>
@ -50,6 +33,25 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
</body>
</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
xdo = name: text: let

View File

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

View File

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

View File

@ -21,9 +21,9 @@ import ./make-test-python.nix ({ pkgs, ... }: {
forceSSL = true;
};
security.acme.email = "me@example.org";
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.
import ./make-test-python.nix ({ pkgs, ...} : rec {
import ./make-test-python.nix ({ pkgs, ...} : let
foo = pkgs.writeText "foo" "Hello World";
in {
name = "misc";
meta = with pkgs.lib.maintainers; {
maintainers = [ eelco ];
};
foo = pkgs.writeText "foo" "Hello World";
machine =
{ 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 = ''
machine.wait_for_unit("rstudio-server.service")
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 =
{ config, pkgs, ... }: {
security.acme.server = "https://caserver:8443/acme/acme/directory";
security.acme.email = "root@example.org";
security.acme.defaults.server = "https://caserver:8443/acme/acme/directory";
security.acme.defaults.email = "root@example.org";
security.acme.acceptTerms = true;
security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ];

View File

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

View File

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