diff options
-rw-r--r-- | flake.nix | 1 | ||||
-rw-r--r-- | pkgs/travelynx.nix | 2 | ||||
-rw-r--r-- | tests/travelynx.nix | 80 |
3 files changed, 82 insertions, 1 deletions
@@ -158,6 +158,7 @@ ntfy-matrix-bot transport_validator; tests.bookwyrm = nixpkgs.nixosTest ./tests/bookwyrm.nix; + tests.travelynx = nixpkgs.nixosTest ./tests/travelynx.nix; }; nixosModules = { diff --git a/pkgs/travelynx.nix b/pkgs/travelynx.nix index 384a660..2b00a2f 100644 --- a/pkgs/travelynx.nix +++ b/pkgs/travelynx.nix @@ -162,7 +162,6 @@ let perlWithPackages = perl.withPackages (_: [ Cache - # CacheCache CAMPDF CryptEksblowfish DateTime @@ -207,6 +206,7 @@ let mkdir -p $out cp -r * $out ''; + passthru.perl = perlWithPackages; }; in travelynx diff --git a/tests/travelynx.nix b/tests/travelynx.nix new file mode 100644 index 0000000..d15899e --- /dev/null +++ b/tests/travelynx.nix @@ -0,0 +1,80 @@ +{ + name = "travelynx-prove-test-suite"; + + nodes.travelynx = { config, pkgs, ... }: { + + services.postgresql = { + enable = true; + ensureDatabases = [ "travelynx" ]; + ensureUsers = [{ + name = "travelynx"; + ensureDBOwnership = true; + }]; + authentication = '' + host all all ::1/127 trust + ''; + }; + + environment.etc."/travelynx".source = pkgs.travelynx; + + environment.etc."/travelynx.conf".text = '' + { + base_url => Mojo::URL->new('http://localhost'), + + cache => { + schedule => './var/cache/travelynx/iris', + realtime => './var/cache/travelynx/iris-rt', + }, + + db => { + host => 'localhost', + port => 5432, + database => 'travelynx', + user => 'travelynx', + }, + + hypnotoad => { + accepts => 100, + clients => 10, + listen => [ 'http://127.0.0.1:8093' ], + pid_file => '/tmp/travelynx.pid', + workers => 2, + spare => 2, + }, + + mail => { + disabled => 1, + }, + + ref => { + issues => 'https://github.com/derf/travelynx/issues', + source => 'https://github.com/derf/travelynx', + }, + + secrets => [ + "secret" + ], + + version => 'vm-test', + }; + ''; + + environment.systemPackages = [ pkgs.travelynx.perl ]; + }; + + testScript = '' + machine.start() + machine.wait_for_unit("postgresql.service") + + machine.succeed("cp -r /etc/travelynx/* .") + machine.succeed("chmod +w -R .") + machine.succeed("cp /etc/travelynx.conf .") + + machine.succeed("./index.pl database migrate") + + # this executes travelynx's own test suite, which requires a working database + # & networking, hence i didn't put it into the package's test phase + # (also, it seems to be failing?) + machine.succeed("prove") + ''; +} |