Use hydra-module.nix in the tests

[?]
Nov 6, 2013, 5:10 PM
WQ2VQ7H3CTHM47EOW3F3BB2OUAI7ZXX5FBBAD2DODQOFO5LRM4WAC

Dependencies

  • [2] WGDX4QRI Adjust to the NixOS/Nixpkgs merge
  • [3] ZIIXICG7 Make the outputs' outpaths available via the Build JSON API
  • [4] XWNMTW6P Drop building on i686-linux
  • [5] 55QLDPQD Use hydra-init / hydra-create-user in the tests
  • [6] YQWH4POV * Simplify.
  • [7] IKC3UFA3 Fix VM test
  • [8] KYSBJAYN Allow dashes in jobset input names
  • [9] YI3BZG5N Cleanup Jobset serialization
  • [10] 3PNG7NIB Remove trailing whitespace
  • [11] UGA45FNC Add a plugin for backing up builds in s3
  • [12] 2DGIP6L4 Cleanup build serialization
  • [13] SYLVCTT6 Start api cleanup with the User model
  • [14] WDNDBFSG 32-bit qemu can only do 2047 MB
  • [15] 7C6HSXUQ * Start of a regression test for Hydra.
  • [16] IZYR3KTL release.nix: Get rid of the "system" argument
  • [17] MQYHIUEE Cleanup eval serialization
  • [18] NP7IOJ4Q Flesh out the API a bit
  • [19] SQVJAUOR Fix the test
  • [20] A3A2O37I Work around 9P corruption on 32-bit
  • [21] LZVO64YG Merge in the first bits of the API work
  • [22] 4VYSDP4I Add eager fetching of relations and enable that for jobset->jobsetinputs
  • [23] 6CZHII3Q Use <...> syntax
  • [*] T4LLYESZ * Nix expression for building Hydra.
  • [*] LOHWNXEJ Cleanup

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
    [2.69][6.239:307](),[6.217][6.239:307]()
    let hydra = builtins.getAttr system build; in # build.${system}
  • replacement in release.nix at line 171
    [6.324][6.324:536](),[6.536][6.536:537](),[6.536][6.536:537]()
    machine =
    { config, pkgs, ... }:
    { services.postgresql.enable = true;
    services.postgresql.package = pkgs.postgresql92;
    environment.systemPackages = [ hydra ];
    };
    [6.324]
    [6.537]
    machine = hydraServer (builtins.getAttr system build); # build.${system}
  • edit in release.nix at line 173
    [6.556][5.0:55]()
    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 &");
    [6.567]
    [6.1038]
    $machine->waitForJob("hydra-init");
    $machine->waitForJob("hydra-server");
    $machine->waitForJob("hydra-evaluator");
    $machine->waitForJob("hydra-queue-runner");
  • edit in release.nix at line 179
    [6.1083]
    [6.1083]
    $machine->succeed("curl --fail http://localhost:3000/");
  • edit in release.nix at line 185
    [2.139][6.0:70](),[6.126][6.0:70]()
    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;
    };
    [6.211]
    [6.513]
    machine = hydraServer (builtins.getAttr system build); # build.${system}
  • replacement in release.nix at line 190
    [6.543][6.543:589]()
    $machine->waitForJob("postgresql");
    [6.543]
    [6.589]
    $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"
    [6.590]
    [6.1190]
    # 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
    [6.1311]
    [6.1311]
    , "chown -R hydra /run/jobset /tmp/nix"
  • replacement in release.nix at line 202
    [6.1329][6.1329:1366](),[6.1366][5.559:775]()
    # 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 &");
    [6.1329]
    [6.1606]
    # 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
    [6.1652][6.1652:1720]()
    $machine->mustSucceed("perl ${./tests/api-test.pl} >&2");
    [6.1652]
    [6.1720]
    # Run the API tests.
    $machine->mustSucceed("su hydra -c 'perl ${./tests/api-test.pl}' >&2");
  • replacement in release.nix at line 234
    [6.855][6.855:887]()
    $machine->mustSucceed
    [6.855]
    [6.887]
    $machine->succeed
  • replacement in release.nix at line 244
    [6.1264][6.1264:1346]()
    $machine->mustSucceed("fakes3 --root /tmp/s3 --port 80 &>/dev/null &");
    [6.1264]
    [6.1346]
    $machine->succeed("fakes3 --root /tmp/s3 --port 80 &>/dev/null &");
  • replacement in release.nix at line 247
    [6.1390][6.1390:1687]()
    $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");
    [6.1390]
    [6.1687]
    $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
    [6.38520][6.38520:38737]()
    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");
    [6.245]
    [6.38737]
    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
    [6.39049][6.39049:39299]()
    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");
    [6.39049]
    [6.39299]
    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
    [6.39798][3.196:344]()
    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'");