forked from mirrors/nixpkgs
nixos/gitea: add a nixos test to ensure the initial database migration succeeds so the application can start
This commit is contained in:
parent
3ed52c7804
commit
0dde47a58a
|
@ -301,6 +301,7 @@ in rec {
|
|||
tests.fsck = callTest tests/fsck.nix {};
|
||||
tests.fwupd = callTest tests/fwupd.nix {};
|
||||
tests.gdk-pixbuf = callTest tests/gdk-pixbuf.nix {};
|
||||
tests.gitea = callSubTests tests/gitea.nix {};
|
||||
tests.gitlab = callTest tests/gitlab.nix {};
|
||||
tests.gitolite = callTest tests/gitolite.nix {};
|
||||
tests.gjs = callTest tests/gjs.nix {};
|
||||
|
|
74
nixos/tests/gitea.nix
Normal file
74
nixos/tests/gitea.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ system ? builtins.currentSystem }:
|
||||
|
||||
with import ../lib/testing.nix { inherit system; };
|
||||
with pkgs.lib;
|
||||
|
||||
{
|
||||
mysql = makeTest {
|
||||
name = "gitea-mysql";
|
||||
meta.maintainers = [ maintainers.aanderse ];
|
||||
|
||||
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";
|
||||
services.gitea.database.password = "secret";
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
|
||||
$machine->waitForUnit('gitea.service');
|
||||
$machine->waitForOpenPort('3000');
|
||||
$machine->succeed("curl --fail http://localhost:3000/");
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue