nixos/tests/taskserver: Fix build
The test fails because the way the configuration switch was implemented back then was by using a dummy configuration and simply activating that dummy configuration from within the test script. Nowadays, this doesn't work anymore and fails to typecheck because the dummy "newServer" will inherit the same value for networking.hostName, which in turn will generate two attributes for "server": > testScriptWithTypes:43: error: Name "server" already defined on line 43 > [no-redef] > client1: Machine; client2: Machine; server: Machine; server: Machine; Fortunately, we don't need to do workarounds like this anymore and there is the "specialisation" option, which allows to do this in a less ugly way (and it also works with mypy). Signed-off-by: aszlig <aszlig@nix.build>
This commit is contained in:
parent
e70af2ea7e
commit
9b6f9e4624
1 changed files with 9 additions and 17 deletions
|
@ -69,23 +69,14 @@ in {
|
|||
testOrganisation.users = [ "alice" "foo" ];
|
||||
anotherOrganisation.users = [ "bob" ];
|
||||
};
|
||||
};
|
||||
|
||||
# New generation of the server with manual config
|
||||
newServer = { lib, nodes, ... }: {
|
||||
imports = [ server ];
|
||||
services.taskserver.pki.manual = {
|
||||
ca.cert = snakeOil.cacert;
|
||||
server.cert = snakeOil.cert;
|
||||
server.key = snakeOil.key;
|
||||
server.crl = snakeOil.crl;
|
||||
};
|
||||
# This is to avoid assigning a different network address to the new
|
||||
# generation.
|
||||
networking = lib.mapAttrs (lib.const lib.mkForce) {
|
||||
interfaces.eth1.ipv4 = nodes.server.config.networking.interfaces.eth1.ipv4;
|
||||
inherit (nodes.server.config.networking)
|
||||
hostName primaryIPAddress extraHosts;
|
||||
specialisation.manual-config.configuration = {
|
||||
services.taskserver.pki.manual = {
|
||||
ca.cert = snakeOil.cacert;
|
||||
server.cert = snakeOil.cert;
|
||||
server.key = snakeOil.key;
|
||||
server.crl = snakeOil.crl;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -103,7 +94,8 @@ in {
|
|||
testScript = { nodes, ... }: let
|
||||
cfg = nodes.server.config.services.taskserver;
|
||||
portStr = toString cfg.listenPort;
|
||||
newServerSystem = nodes.newServer.config.system.build.toplevel;
|
||||
specialisations = "${nodes.server.system.build.toplevel}/specialisation";
|
||||
newServerSystem = "${specialisations}/manual-config";
|
||||
switchToNewServer = "${newServerSystem}/bin/switch-to-configuration test";
|
||||
in ''
|
||||
from shlex import quote
|
||||
|
|
Loading…
Reference in a new issue