mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-08 03:26:08 +03:00
Merge branch 'staging-next' into staging
Conflicts (simple): nixos/doc/manual/release-notes/rl-1909.xml
This commit is contained in:
commit
ee86a325dd
392 changed files with 11536 additions and 4972 deletions
|
@ -135,6 +135,7 @@ in
|
|||
leaps = handleTest ./leaps.nix {};
|
||||
lidarr = handleTest ./lidarr.nix {};
|
||||
#lightdm = handleTest ./lightdm.nix {};
|
||||
limesurvey = handleTest ./limesurvey.nix {};
|
||||
login = handleTest ./login.nix {};
|
||||
#logstash = handleTest ./logstash.nix {};
|
||||
mailcatcher = handleTest ./mailcatcher.nix {};
|
||||
|
@ -161,6 +162,7 @@ in
|
|||
nat.standalone = handleTest ./nat.nix { withFirewall = false; };
|
||||
ndppd = handleTest ./ndppd.nix {};
|
||||
neo4j = handleTest ./neo4j.nix {};
|
||||
nesting = handleTest ./nesting.nix {};
|
||||
netdata = handleTest ./netdata.nix {};
|
||||
networking.networkd = handleTest ./networking.nix { networkd = true; };
|
||||
networking.scripted = handleTest ./networking.nix { networkd = false; };
|
||||
|
|
21
nixos/tests/limesurvey.nix
Normal file
21
nixos/tests/limesurvey.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
import ./make-test.nix ({ pkgs, ... }: {
|
||||
name = "limesurvey";
|
||||
meta.maintainers = [ pkgs.stdenv.lib.maintainers.aanderse ];
|
||||
|
||||
machine =
|
||||
{ ... }:
|
||||
{ services.limesurvey.enable = true;
|
||||
services.limesurvey.virtualHost.hostName = "example.local";
|
||||
services.limesurvey.virtualHost.adminAddr = "root@example.local";
|
||||
|
||||
# limesurvey won't work without a dot in the hostname
|
||||
networking.hosts."127.0.0.1" = [ "example.local" ];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
|
||||
$machine->waitForUnit('phpfpm-limesurvey.service');
|
||||
$machine->succeed('curl http://example.local/') =~ /The following surveys are available/ or die;
|
||||
'';
|
||||
})
|
42
nixos/tests/nesting.nix
Normal file
42
nixos/tests/nesting.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
import ./make-test.nix {
|
||||
name = "nesting";
|
||||
nodes = {
|
||||
clone = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.cowsay ];
|
||||
nesting.clone = [
|
||||
({ pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.hello ];
|
||||
})
|
||||
];
|
||||
};
|
||||
children = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.cowsay ];
|
||||
nesting.children = [
|
||||
({ pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.hello ];
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
testScript = ''
|
||||
$clone->waitForUnit("default.target");
|
||||
$clone->succeed("cowsay hey");
|
||||
$clone->fail("hello");
|
||||
|
||||
# Nested clones do inherit from parent
|
||||
$clone->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test");
|
||||
$clone->succeed("cowsay hey");
|
||||
$clone->succeed("hello");
|
||||
|
||||
|
||||
$children->waitForUnit("default.target");
|
||||
$children->succeed("cowsay hey");
|
||||
$children->fail("hello");
|
||||
|
||||
# Nested children do not inherit from parent
|
||||
$children->succeed("/run/current-system/fine-tune/child-1/bin/switch-to-configuration test");
|
||||
$children->fail("cowsay hey");
|
||||
$children->succeed("hello");
|
||||
|
||||
'';
|
||||
}
|
|
@ -1,6 +1,13 @@
|
|||
import ./make-test.nix ({ lib, pkgs, ... }:
|
||||
{ system ? builtins.currentSystem
|
||||
, config ? {}
|
||||
, pkgs ? import ../.. { inherit system config; }
|
||||
}:
|
||||
|
||||
with pkgs.lib;
|
||||
with import ../lib/testing.nix { inherit system pkgs; };
|
||||
|
||||
let
|
||||
escape' = str: lib.replaceChars [''"'' "$" "\n"] [''\\\"'' "\\$" ""] str;
|
||||
escape' = str: replaceChars [''"'' "$" "\n"] [''\\\"'' "\\$" ""] str;
|
||||
|
||||
/*
|
||||
* The attrset `exporterTests` contains one attribute
|
||||
|
@ -51,6 +58,25 @@ let
|
|||
|
||||
exporterTests = {
|
||||
|
||||
bind = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
};
|
||||
metricProvider = {
|
||||
services.bind.enable = true;
|
||||
services.bind.extraConfig = ''
|
||||
statistics-channels {
|
||||
inet 127.0.0.1 port 8053 allow { localhost; };
|
||||
};
|
||||
'';
|
||||
};
|
||||
exporterTest = ''
|
||||
waitForUnit("prometheus-bind-exporter.service");
|
||||
waitForOpenPort(9119);
|
||||
succeed("curl -sSf http://localhost:9119/metrics" | grep -q 'bind_query_recursions_total 0');
|
||||
'';
|
||||
};
|
||||
|
||||
blackbox = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
@ -106,25 +132,6 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
bind = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
};
|
||||
metricProvider = {
|
||||
services.bind.enable = true;
|
||||
services.bind.extraConfig = ''
|
||||
statistics-channels {
|
||||
inet 127.0.0.1 port 8053 allow { localhost; };
|
||||
};
|
||||
'';
|
||||
};
|
||||
exporterTest = ''
|
||||
waitForUnit("prometheus-bind-exporter.service");
|
||||
waitForOpenPort(9119);
|
||||
succeed("curl -sSf http://localhost:9119/metrics" | grep -q 'bind_query_recursions_total 0');
|
||||
'';
|
||||
};
|
||||
|
||||
dovecot = {
|
||||
exporterConfig = {
|
||||
enable = true;
|
||||
|
@ -309,27 +316,23 @@ let
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nodes = lib.mapAttrs (exporter: testConfig: lib.mkMerge [{
|
||||
services.prometheus.exporters.${exporter} = testConfig.exporterConfig;
|
||||
} testConfig.metricProvider or {}]) exporterTests;
|
||||
|
||||
testScript = lib.concatStrings (lib.mapAttrsToList (exporter: testConfig: (''
|
||||
subtest "${exporter}", sub {
|
||||
${"$"+exporter}->start();
|
||||
${lib.concatStringsSep " " (map (line: ''
|
||||
${"$"+exporter}->${line};
|
||||
'') (lib.splitString "\n" (lib.removeSuffix "\n" testConfig.exporterTest)))}
|
||||
${"$"+exporter}->shutdown();
|
||||
};
|
||||
'')) exporterTests);
|
||||
in
|
||||
{
|
||||
name = "prometheus-exporters";
|
||||
mapAttrs (exporter: testConfig: (makeTest {
|
||||
name = "prometheus-${exporter}-exporter";
|
||||
|
||||
inherit nodes testScript;
|
||||
nodes.${exporter} = mkMerge [{
|
||||
services.prometheus.exporters.${exporter} = testConfig.exporterConfig;
|
||||
} testConfig.metricProvider or {}];
|
||||
|
||||
meta = with lib.maintainers; {
|
||||
testScript = ''
|
||||
${"$"+exporter}->start();
|
||||
${concatStringsSep " " (map (line: ''
|
||||
${"$"+exporter}->${line};
|
||||
'') (splitString "\n" (removeSuffix "\n" testConfig.exporterTest)))}
|
||||
${"$"+exporter}->shutdown();
|
||||
'';
|
||||
|
||||
meta = with maintainers; {
|
||||
maintainers = [ willibutz ];
|
||||
};
|
||||
})
|
||||
})) exporterTests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue