summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/travelynx.nix80
1 files changed, 80 insertions, 0 deletions
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")
+ '';
+}