diff options
author | stuebinm | 2024-04-17 22:31:55 +0200 |
---|---|---|
committer | stuebinm | 2024-04-17 22:31:55 +0200 |
commit | 806593f53dde83f367fd9f6ee74a21aef97faf44 (patch) | |
tree | de7829f2bcdfdcb9409c881e6b56232342db4449 | |
parent | d0534bdc8ba71883385c91be0bfcdc95a9c84717 (diff) |
tests: test travelynx using upstream `prove` suite
unfortunately, these tests seem to be broken at the moment? Or at least
I cannot see where my packaging differs from the provided cpanfile.snapshot.
-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") + ''; +} |