From c42c675a42ec04c1b1cc684b75cdd25224b5993c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 10 Mar 2010 15:48:45 +0000 Subject: [PATCH] * Start of a regression test for Hydra. --- release.nix | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/release.nix b/release.nix index d8d48e0d..212dc768 100644 --- a/release.nix +++ b/release.nix @@ -1,5 +1,5 @@ { nixpkgs ? ../nixpkgs -, hydraSrc ? {outPath = ./.; rev = 1234;} +, hydraSrc ? {outPath = ../hydra-wc; rev = 1234;} , officialRelease ? false }: @@ -117,5 +117,44 @@ rec { description = "Build of Hydra on ${system}"; }; }; + + + tests = + { nixos ? ../nixos, system ? "x86_64-linux" }: + + let hydra = build { inherit system; }; in + + with import "${nixos}/lib/testing.nix" { inherit nixpkgs system; services = null; }; + + { + install = simpleTest { + + machine = + { config, pkgs, ... }: + { services.postgresql.enable = true; + environment.systemPackages = [ hydra ]; + }; + + testScript = + '' + $machine->waitForJob("postgresql"); + + # Initialise the database and the state. + $machine->mustSucceed + ( "createdb -O root hydra", + , "psql hydra -f ${hydra}/share/hydra/sql/hydra-postgresql.sql" + , "mkdir /var/lib/hydra" + ); + + # Start the web interface. + #$machine->mustSucceed("HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=hydra;' hydra_server.pl >&2 &"); + #$machine->waitForOpenPort("3000"); + ''; + + }; + + }; + + }