Merge pull request #85747 from tfc/port-redmine-test

nixosTests.redmine: Port to python
This commit is contained in:
Domen Kožar 2020-04-22 09:54:12 +02:00 committed by GitHub
commit ef9506d483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,74 +3,42 @@
pkgs ? import ../.. { inherit system config; } pkgs ? import ../.. { inherit system config; }
}: }:
with import ../lib/testing.nix { inherit system pkgs; }; with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let
mysqlTest = package: makeTest { redmineTest = { name, type }: makeTest {
machine = name = "redmine-${name}";
{ config, pkgs, ... }: machine = { config, pkgs, ... }: {
{ services.redmine.enable = true; services.redmine = {
services.redmine.package = package; enable = true;
services.redmine.database.type = "mysql2"; package = pkgs.redmine;
services.redmine.plugins = { database.type = type;
plugins = {
redmine_env_auth = pkgs.fetchurl { redmine_env_auth = pkgs.fetchurl {
url = "https://github.com/Intera/redmine_env_auth/archive/0.7.zip"; url = "https://github.com/Intera/redmine_env_auth/archive/0.7.zip";
sha256 = "1xb8lyarc7mpi86yflnlgyllh9hfwb9z304f19dx409gqpia99sc"; sha256 = "1xb8lyarc7mpi86yflnlgyllh9hfwb9z304f19dx409gqpia99sc";
}; };
}; };
services.redmine.themes = { themes = {
dkuk-redmine_alex_skin = pkgs.fetchurl { dkuk-redmine_alex_skin = pkgs.fetchurl {
url = "https://bitbucket.org/dkuk/redmine_alex_skin/get/1842ef675ef3.zip"; url = "https://bitbucket.org/dkuk/redmine_alex_skin/get/1842ef675ef3.zip";
sha256 = "0hrin9lzyi50k4w2bd2b30vrf1i4fi1c0gyas5801wn8i7kpm9yl"; sha256 = "0hrin9lzyi50k4w2bd2b30vrf1i4fi1c0gyas5801wn8i7kpm9yl";
}; };
}; };
}; };
};
testScript = '' testScript = ''
startAll; start_all()
$machine->waitForUnit('redmine.service'); machine.wait_for_unit("redmine.service")
$machine->waitForOpenPort('3000'); machine.wait_for_open_port(3000)
$machine->succeed("curl --fail http://localhost:3000/"); machine.succeed("curl --fail http://localhost:3000/")
''; '';
}; } // {
pgsqlTest = package: makeTest {
machine =
{ config, pkgs, ... }:
{ services.redmine.enable = true;
services.redmine.package = package;
services.redmine.database.type = "postgresql";
services.redmine.plugins = {
redmine_env_auth = pkgs.fetchurl {
url = "https://github.com/Intera/redmine_env_auth/archive/0.7.zip";
sha256 = "1xb8lyarc7mpi86yflnlgyllh9hfwb9z304f19dx409gqpia99sc";
};
};
services.redmine.themes = {
dkuk-redmine_alex_skin = pkgs.fetchurl {
url = "https://bitbucket.org/dkuk/redmine_alex_skin/get/1842ef675ef3.zip";
sha256 = "0hrin9lzyi50k4w2bd2b30vrf1i4fi1c0gyas5801wn8i7kpm9yl";
};
};
};
testScript = ''
startAll;
$machine->waitForUnit('redmine.service');
$machine->waitForOpenPort('3000');
$machine->succeed("curl --fail http://localhost:3000/");
'';
};
in
{
mysql = mysqlTest pkgs.redmine // {
name = "mysql";
meta.maintainers = [ maintainers.aanderse ];
};
pgsql = pgsqlTest pkgs.redmine // {
name = "pgsql";
meta.maintainers = [ maintainers.aanderse ]; meta.maintainers = [ maintainers.aanderse ];
}; };
in {
mysql = redmineTest { name = "mysql"; type = "mysql2"; };
pgsql = redmineTest { name = "pgsql"; type = "postgresql"; };
} }