diff options
author | Aaron Andersen <aaron@fosslib.net> | 2018-11-05 21:06:30 -0500 |
---|---|---|
committer | Aaron Andersen <aaron@fosslib.net> | 2018-11-08 17:31:05 -0500 |
commit | 0dde47a58acdd3cff855796bbd899c90c7fb25b5 (patch) | |
tree | 967181af9ce29381ced2a57d52f276070f02d1a9 /nixos | |
parent | 3ed52c78047bcc4b74d34e0cee179bb708aebdc0 (diff) | |
download | nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.tar nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.tar.gz nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.tar.bz2 nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.tar.lz nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.tar.xz nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.tar.zst nixlib-0dde47a58acdd3cff855796bbd899c90c7fb25b5.zip |
nixos/gitea: add a nixos test to ensure the initial database migration succeeds so the application can start
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/release.nix | 1 | ||||
-rw-r--r-- | nixos/tests/gitea.nix | 74 |
2 files changed, 75 insertions, 0 deletions
diff --git a/nixos/release.nix b/nixos/release.nix index 4647f28be186..a3d33887db27 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -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 {}; diff --git a/nixos/tests/gitea.nix b/nixos/tests/gitea.nix new file mode 100644 index 000000000000..7ffe05ef3f1f --- /dev/null +++ b/nixos/tests/gitea.nix @@ -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/"); + ''; + }; +} |