2018-11-11 08:41:11 +00:00
|
|
|
{ system ? builtins.currentSystem,
|
|
|
|
config ? {},
|
|
|
|
pkgs ? import ../.. { inherit system config; }
|
|
|
|
}:
|
2018-11-06 02:06:30 +00:00
|
|
|
|
2018-11-11 08:41:11 +00:00
|
|
|
with import ../lib/testing.nix { inherit system pkgs; };
|
2018-11-06 02:06:30 +00:00
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
mysql = makeTest {
|
|
|
|
name = "gitea-mysql";
|
2019-05-11 01:00:40 +01:00
|
|
|
meta.maintainers = with maintainers; [ aanderse kolaente ];
|
2018-11-06 02:06:30 +00:00
|
|
|
|
|
|
|
machine =
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
{ services.mysql.enable = true;
|
|
|
|
services.mysql.package = pkgs.mariadb;
|
|
|
|
services.mysql.ensureDatabases = [ "gitea" ];
|
|
|
|
services.mysql.ensureUsers = [
|
|
|
|
{ name = "gitea";
|
|
|
|
ensurePermissions = { "gitea.*" = "ALL PRIVILEGES"; };
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
services.gitea.enable = true;
|
|
|
|
services.gitea.database.type = "mysql";
|
|
|
|
services.gitea.database.socket = "/run/mysqld/mysqld.sock";
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$machine->waitForUnit('gitea.service');
|
|
|
|
$machine->waitForOpenPort('3000');
|
|
|
|
$machine->succeed("curl --fail http://localhost:3000/");
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
postgres = makeTest {
|
|
|
|
name = "gitea-postgres";
|
|
|
|
meta.maintainers = [ maintainers.aanderse ];
|
|
|
|
|
|
|
|
machine =
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
services.gitea.enable = true;
|
|
|
|
services.gitea.database.type = "postgres";
|
2019-02-11 02:10:56 +00:00
|
|
|
services.gitea.database.passwordFile = pkgs.writeText "db-password" "secret";
|
2018-11-06 02:06:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$machine->waitForUnit('gitea.service');
|
|
|
|
$machine->waitForOpenPort('3000');
|
|
|
|
$machine->succeed("curl --fail http://localhost:3000/");
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
sqlite = makeTest {
|
|
|
|
name = "gitea-sqlite";
|
|
|
|
meta.maintainers = [ maintainers.aanderse ];
|
|
|
|
|
|
|
|
machine =
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
{ services.gitea.enable = true;
|
2019-01-14 14:56:20 +00:00
|
|
|
services.gitea.disableRegistration = true;
|
2018-11-06 02:06:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$machine->waitForUnit('gitea.service');
|
|
|
|
$machine->waitForOpenPort('3000');
|
|
|
|
$machine->succeed("curl --fail http://localhost:3000/");
|
2019-01-14 14:56:20 +00:00
|
|
|
$machine->succeed("curl --fail http://localhost:3000/user/sign_up | grep 'Registration is disabled. Please contact your site administrator.'");
|
2018-11-06 02:06:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|