flake.nix: run tests against pinned nixpkgs
and migrate to the new runTest, which evaluates much faster.
This commit is contained in:
parent
1feca02008
commit
ef1e02e555
7 changed files with 80 additions and 56 deletions
|
@ -1,6 +1,9 @@
|
|||
# This tests is used to test features requiring several mail domains.
|
||||
|
||||
{ pkgs ? import <nixpkgs> {}, ...}:
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
hashPassword = password: pkgs.runCommand
|
||||
|
@ -12,8 +15,9 @@ let
|
|||
|
||||
password = pkgs.writeText "password" "password";
|
||||
|
||||
domainGenerator = domain: { config, pkgs, ... }: {
|
||||
domainGenerator = domain: { pkgs, ... }: {
|
||||
imports = [../default.nix];
|
||||
environment.systemPackages = with pkgs; [ netcat ];
|
||||
virtualisation.memorySize = 1024;
|
||||
mailserver = {
|
||||
enable = true;
|
||||
|
@ -36,8 +40,9 @@ let
|
|||
|
||||
in
|
||||
|
||||
pkgs.nixosTest {
|
||||
{
|
||||
name = "multiple";
|
||||
|
||||
nodes = {
|
||||
domain1 = {...}: {
|
||||
imports = [
|
||||
|
@ -50,7 +55,7 @@ pkgs.nixosTest {
|
|||
};
|
||||
};
|
||||
domain2 = domainGenerator "domain2.com";
|
||||
client = { config, pkgs, ... }: {
|
||||
client = { pkgs, ... }: {
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeScriptBin "mail-check" ''
|
||||
${pkgs.python3}/bin/python ${../scripts/mail-check.py} $@
|
||||
|
@ -65,10 +70,10 @@ pkgs.nixosTest {
|
|||
|
||||
# TODO put this blocking into the systemd units?
|
||||
domain1.wait_until_succeeds(
|
||||
"set +e; timeout 1 ${pkgs.netcat}/bin/nc -U /run/rspamd/rspamd-milter.sock < /dev/null; [ $? -eq 124 ]"
|
||||
"set +e; timeout 1 nc -U /run/rspamd/rspamd-milter.sock < /dev/null; [ $? -eq 124 ]"
|
||||
)
|
||||
domain2.wait_until_succeeds(
|
||||
"set +e; timeout 1 ${pkgs.netcat}/bin/nc -U /run/rspamd/rspamd-milter.sock < /dev/null; [ $? -eq 124 ]"
|
||||
"set +e; timeout 1 nc -U /run/rspamd/rspamd-milter.sock < /dev/null; [ $? -eq 124 ]"
|
||||
)
|
||||
|
||||
# user@domain1.com sends a mail to user@domain2.com
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue