From 806593f53dde83f367fd9f6ee74a21aef97faf44 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 17 Apr 2024 22:31:55 +0200 Subject: 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. --- tests/travelynx.nix | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/travelynx.nix (limited to 'tests') 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") + ''; +} -- cgit v1.2.3