Use hydra-module.nix in the tests
[?]
Nov 6, 2013, 5:10 PM
WQ2VQ7H3CTHM47EOW3F3BB2OUAI7ZXX5FBBAD2DODQOFO5LRM4WACDependencies
- [2]
WGDX4QRIAdjust to the NixOS/Nixpkgs merge - [3]
ZIIXICG7Make the outputs' outpaths available via the Build JSON API - [4]
XWNMTW6PDrop building on i686-linux - [5]
55QLDPQDUse hydra-init / hydra-create-user in the tests - [6]
6CZHII3QUse <...> syntax - [7]
MQYHIUEECleanup eval serialization - [8]
3PNG7NIBRemove trailing whitespace - [9]
IKC3UFA3Fix VM test - [10]
LZVO64YGMerge in the first bits of the API work - [11]
KYSBJAYNAllow dashes in jobset input names - [12]
YI3BZG5NCleanup Jobset serialization - [13]
4VYSDP4IAdd eager fetching of relations and enable that for jobset->jobsetinputs - [14]
SQVJAUORFix the test - [15]
WDNDBFSG32-bit qemu can only do 2047 MB - [16]
IZYR3KTLrelease.nix: Get rid of the "system" argument - [17]
2DGIP6L4Cleanup build serialization - [18]
NP7IOJ4QFlesh out the API a bit - [19]
YQWH4POV* Simplify. - [20]
7C6HSXUQ* Start of a regression test for Hydra. - [21]
SYLVCTT6Start api cleanup with the User model - [22]
UGA45FNCAdd a plugin for backing up builds in s3 - [23]
A3A2O37IWork around 9P corruption on 32-bit - [*]
T4LLYESZ* Nix expression for building Hydra. - [*]
LOHWNXEJCleanup
Change contents
- edit in release.nix at line 10[4.52][26.0]
hydraServer = hydraPkg:{ config, pkgs, ... }:{ imports = [ ./hydra-module.nix ];virtualisation.memorySize = 1024;services.hydra.enable = true;services.hydra.package = hydraPkg;services.hydra.hydraURL = "http://hydra.example.org";services.hydra.notificationSender = "admin@hydra.example.org";services.postgresql.enable = true;services.postgresql.package = pkgs.postgresql92; - edit in release.nix at line 25[26.1][6.103]
environment.systemPackages = [ pkgs.perlPackages.LWP pkgs.perlPackages.JSON ];}; - edit in release.nix at line 170
let hydra = builtins.getAttr system build; in # build.${system} - replacement in release.nix at line 171
machine ={ config, pkgs, ... }:{ services.postgresql.enable = true;services.postgresql.package = pkgs.postgresql92;environment.systemPackages = [ hydra ];};machine = hydraServer (builtins.getAttr system build); # build.${system} - edit in release.nix at line 173
let dbi = "dbi:Pg:dbname=hydra;user=root;"; in - replacement in release.nix at line 174[6.567]→[6.567:613](∅→∅),[6.613]→[6.808:809](∅→∅),[6.808]→[6.808:809](∅→∅),[6.809]→[6.614:697](∅→∅),[6.697]→[5.56:221](∅→∅),[5.221]→[6.819:875](∅→∅),[6.819]→[6.819:875](∅→∅),[6.875]→[6.1075:1076](∅→∅),[6.1075]→[6.1075:1076](∅→∅),[6.1076]→[6.876:913](∅→∅),[6.913]→[5.222:322](∅→∅)
$machine->waitForJob("postgresql");# Initialise the database and the state.$machine->mustSucceed( "createdb -O root hydra", "HYDRA_DBI='${dbi}' hydra-init", "HYDRA_DBI='${dbi}' hydra-init" # again to test idempotence, "mkdir /var/lib/hydra");# Start the web interface.$machine->mustSucceed("HYDRA_DATA=/var/lib/hydra HYDRA_DBI='${dbi}' hydra-server >&2 &");$machine->waitForJob("hydra-init");$machine->waitForJob("hydra-server");$machine->waitForJob("hydra-evaluator");$machine->waitForJob("hydra-queue-runner"); - edit in release.nix at line 179
$machine->succeed("curl --fail http://localhost:3000/"); - edit in release.nix at line 185
let hydra = builtins.getAttr system build; in # build."${system}" - replacement in release.nix at line 186[6.211]→[6.211:457](∅→∅),[6.457]→[6.0:44](∅→∅),[6.44]→[6.71:128](∅→∅),[6.44]→[6.501:513](∅→∅),[6.128]→[6.501:513](∅→∅),[6.501]→[6.501:513](∅→∅)
machine ={ config, pkgs, ... }:{ services.postgresql.enable = true;services.postgresql.package = pkgs.postgresql92;environment.systemPackages = [ hydra pkgs.perlPackages.LWP pkgs.perlPackages.JSON ];virtualisation.memorySize = 2047;boot.kernelPackages = pkgs.linuxPackages_3_10;};machine = hydraServer (builtins.getAttr system build); # build.${system} - replacement in release.nix at line 190
$machine->waitForJob("postgresql");$machine->waitForJob("hydra-init"); - replacement in release.nix at line 192[6.590]→[6.590:714](∅→∅),[6.714]→[5.379:558](∅→∅),[5.558]→[6.794:833](∅→∅),[6.794]→[6.794:833](∅→∅),[6.1114]→[6.1114:1190](∅→∅)
# Initialise the database and the state.$machine->mustSucceed( "createdb -O root hydra", "HYDRA_DBI='${dbi}' hydra-init", "HYDRA_DBI='${dbi}' hydra-create-user root --email-address 'e.dolstra\@tudelft.nl' --password foobar --role admin", "mkdir /var/lib/hydra", "mkdir /run/jobset", "chmod 755 /run/jobset"# Create an admin account and some other state.$machine->succeed( "su hydra -c \"hydra-create-user root --email-address 'e.dolstra\@tudelft.nl' --password foobar --role admin\"", "mkdir /run/jobset /tmp/nix", "chmod 755 /run/jobset /tmp/nix" - edit in release.nix at line 199
, "chown -R hydra /run/jobset /tmp/nix" - replacement in release.nix at line 202
# Start the web interface.$machine->mustSucceed("NIX_STORE_DIR=/run/nix NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='${dbi}' LOGNAME=root DBIC_TRACE=1 hydra-server -d >&2 &");# Start the web interface with some weird settings.$machine->succeed("systemctl stop hydra-server hydra-evaluator hydra-queue-runner");$machine->mustSucceed("su hydra -c 'NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix DBIC_TRACE=1 hydra-server -d' >&2 &"); - replacement in release.nix at line 207
$machine->mustSucceed("perl ${./tests/api-test.pl} >&2");# Run the API tests.$machine->mustSucceed("su hydra -c 'perl ${./tests/api-test.pl}' >&2"); - replacement in release.nix at line 234
$machine->mustSucceed$machine->succeed - replacement in release.nix at line 244
$machine->mustSucceed("fakes3 --root /tmp/s3 --port 80 &>/dev/null &");$machine->succeed("fakes3 --root /tmp/s3 --port 80 &>/dev/null &"); - replacement in release.nix at line 247
$machine->mustSucceed("cd /tmp && LOGNAME=root AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' HYDRA_CONFIG=${./tests/s3-backup-test.config} perl -I ${hydra}/libexec/hydra/lib -I ${hydra.perlDeps}/lib/perl5/site_perl ./s3-backup-test.pl >&2");$machine->succeed("cd /tmp && LOGNAME=root AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' HYDRA_CONFIG=${./tests/s3-backup-test.config} perl -I ${hydra}/libexec/hydra/lib -I ${hydra.perlDeps}/lib/perl5/site_perl ./s3-backup-test.pl >&2"); - replacement in tests/api-test.pl at line 52
system("LOGNAME=root NIX_STORE_DIR=/run/nix/store NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' hydra-evaluator sample default");system("NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix hydra-evaluator sample default"); - replacement in tests/api-test.pl at line 61
system("echo >> /run/jobset/default.nix; LOGNAME=root NIX_STORE_DIR=/run/nix/store NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' hydra-evaluator sample default");system("echo >> /run/jobset/default.nix; NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix hydra-evaluator sample default"); - replacement in tests/api-test.pl at line 68
ok($build->{buildoutputs}->{out}->{path} =~ /^\/run\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the nix store and named 'job'");[6.39798]ok($build->{buildoutputs}->{out}->{path} =~ /^\/tmp\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the nix store and named 'job'");