Move tests for SCM inputs in to its own .t

[?]
Feb 23, 2021, 7:25 PM
ZTYKNDOLJNMR2WNAUVFJDIIY5J4ICINEP4AHHBNZA3DGVG5GL7EQC

Dependencies

  • [2] 3G475GRT Split out dependent tests in to its own .t
  • [3] WFJ3ZPRM add tests for scm inputs
  • [4] NZXX6PLD Remove the Jobs table
  • [5] OWRS526H Create an ephemeral PostgreSQL database per test
  • [6] UIA3ULNU Give each test its own Nix directories
  • [7] FAIJDQKZ
  • [8] 3RL7VFKE Add tests for "git describe --long".
  • [9] L7RW467Z Add a test for darcs inputs.
  • [10] S5NPXZG3 Fix indentation
  • [11] W6J4PVRP remove debug statement
  • [12] ABB3BIS2 Add eval test for specific git revision
  • [13] 5SMQ2PLK Fix tests
  • [14] HE3GX5IP Optimize fetch-git.
  • [15] ZHBEOOUQ show evaluation errors in log of tests
  • [16] PY5GVGC7 Implemented quoted strings support in hydra-build-products to allow file names with spaces + testcase
  • [17] RBZRCTAL hydra: fixed and re-enabled evaluation tests
  • [18] YDW2NUIW Fix "make check"
  • [19] HX4QYOYA add first evaluations tests
  • [20] SBKX3YH2 cleanup
  • [*] G2ZB6464 first test, not yet in buildprocess

Change contents

  • replacement in tests/evaluation.t at line 10
    [3.969][2.1716:1746]()
    use Test::Simple tests => 60;
    [3.969]
    [3.998]
    use Test::Simple tests => 8;
  • edit in tests/evaluation.t at line 22
    [3.540][3.28:29](),[3.2278][3.28:29](),[3.1188][3.28:29](),[3.1182][3.1679:1680](),[3.1679][3.1679:1680](),[3.1184][3.329:968](),[3.968][3.31:268](),[3.268][3.968:1748](),[3.968][3.968:1748](),[3.1748][3.211:405](),[3.405][3.1748:1757](),[3.1748][3.1748:1757](),[3.1757][3.252:253](),[3.2400][3.252:253](),[3.252][3.252:253](),[3.253][3.1758:1791](),[3.1791][3.1006:1252](),[3.1252][3.0:1](),[3.2025][3.0:1](),[3.2056][3.0:1](),[3.4981][3.0:1](),[3.1680][3.0:1](),[3.1][3.1253:1389](),[3.1389][3.5291:5292](),[3.2150][3.5291:5292](),[3.5291][3.5291:5292](),[3.5292][3.1390:1559](),[3.1559][3.2312:2313](),[3.2312][3.2312:2313](),[3.2313][3.1560:1928]()
    # Test scm inputs
    my @scminputs = (
    {
    name => "svn",
    nixexpr => "svn-input.nix",
    type => "svn",
    uri => "$jobsBaseUri/svn-repo",
    update => getcwd . "/jobs/svn-update.sh"
    },
    {
    name => "svn-checkout",
    nixexpr => "svn-checkout-input.nix",
    type => "svn-checkout",
    uri => "$jobsBaseUri/svn-checkout-repo",
    update => getcwd . "/jobs/svn-checkout-update.sh"
    },
    {
    name => "git",
    nixexpr => "git-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo",
    update => getcwd . "/jobs/git-update.sh"
    },
    {
    name => "git-rev",
    nixexpr => "git-rev-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo 7f60df502b96fd54bbfa64dd94b56d936a407701",
    update => getcwd . "/jobs/git-rev-update.sh"
    },
    {
    name => "deepgit",
    nixexpr => "deepgit-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo master 1",
    update => getcwd . "/jobs/git-update.sh"
    },
    {
    name => "bzr",
    nixexpr => "bzr-input.nix",
    type => "bzr",
    uri => "$jobsBaseUri/bzr-repo",
    update => getcwd . "/jobs/bzr-update.sh"
    },
    {
    name => "bzr-checkout",
    nixexpr => "bzr-checkout-input.nix",
    type => "bzr-checkout",
    uri => "$jobsBaseUri/bzr-checkout-repo",
    update => getcwd . "/jobs/bzr-checkout-update.sh"
    },
    {
    name => "hg",
    nixexpr => "hg-input.nix",
    type => "hg",
    uri => "$jobsBaseUri/hg-repo",
    update => getcwd . "/jobs/hg-update.sh"
    },
    {
    name => "darcs",
    nixexpr => "darcs-input.nix",
    type => "darcs",
    uri => "$jobsBaseUri/darcs-repo",
    update => getcwd . "/jobs/darcs-update.sh"
    }
    );
    foreach my $scm ( @scminputs ) {
    my $scmName = $scm->{"name"};
    my $nixexpr = $scm->{"nixexpr"};
    my $type = $scm->{"type"};
    my $uri = $scm->{"uri"};
    my $update = $scm->{"update"};
    $jobset = createJobsetWithOneInput($scmName, $nixexpr, "src", $type, $uri);
    my $state = 0;
    my $q = 0;
    my ($loop, $updated) = updateRepository($scmName, $update);
    while($loop) {
    my $c = 0;
    # Verify that it can be fetched and possibly queued.
    ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression."); $c++;
    # Verify that the evaluation has queued a new job and evaluate again to ...
    if ($updated) {
    $q++;
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
    ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression again."); $c++;
    }
  • edit in tests/evaluation.t at line 23
    [3.2658][3.1929:2106](),[3.2106][3.2827:2828](),[3.2827][3.2827:2828](),[3.2828][3.2107:2218](),[3.2218][3.212:221]()
    # ... check that it is deterministic and not queued again.
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
    $state++;
    ($loop, $updated) = updateRepository($scmName, $update, getcwd . "/$scmName-repo/");
    }
    }
  • replacement in tests/evaluation.t at line 25
    [3.244][3.244:312]()
    $jobset = createBaseJobset("build-products", "build-products.nix");
    [3.244]
    [3.312]
    my $jobset = createBaseJobset("build-products", "build-products.nix");
  • file addition: input-types.t (----------)
    [22.73]
    use strict;
    use Cwd;
    use Setup;
    (my $datadir, my $pgsql) = test_init();
    require Hydra::Schema;
    require Hydra::Model::DB;
    use Test2::V0;
    my $db = Hydra::Model::DB->new;
    hydra_setup($db);
    my $jobsBaseUri = "file://".getcwd;
    # Test scm inputs
    my @scminputs = (
    {
    name => "svn",
    nixexpr => "svn-input.nix",
    type => "svn",
    uri => "$jobsBaseUri/svn-repo",
    update => getcwd . "/jobs/svn-update.sh"
    },
    {
    name => "svn-checkout",
    nixexpr => "svn-checkout-input.nix",
    type => "svn-checkout",
    uri => "$jobsBaseUri/svn-checkout-repo",
    update => getcwd . "/jobs/svn-checkout-update.sh"
    },
    {
    name => "git",
    nixexpr => "git-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo",
    update => getcwd . "/jobs/git-update.sh"
    },
    {
    name => "git-rev",
    nixexpr => "git-rev-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo 7f60df502b96fd54bbfa64dd94b56d936a407701",
    update => getcwd . "/jobs/git-rev-update.sh"
    },
    {
    name => "deepgit",
    nixexpr => "deepgit-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo master 1",
    update => getcwd . "/jobs/git-update.sh"
    },
    {
    name => "bzr",
    nixexpr => "bzr-input.nix",
    type => "bzr",
    uri => "$jobsBaseUri/bzr-repo",
    update => getcwd . "/jobs/bzr-update.sh"
    },
    {
    name => "bzr-checkout",
    nixexpr => "bzr-checkout-input.nix",
    type => "bzr-checkout",
    uri => "$jobsBaseUri/bzr-checkout-repo",
    update => getcwd . "/jobs/bzr-checkout-update.sh"
    },
    {
    name => "hg",
    nixexpr => "hg-input.nix",
    type => "hg",
    uri => "$jobsBaseUri/hg-repo",
    update => getcwd . "/jobs/hg-update.sh"
    },
    {
    name => "darcs",
    nixexpr => "darcs-input.nix",
    type => "darcs",
    uri => "$jobsBaseUri/darcs-repo",
    update => getcwd . "/jobs/darcs-update.sh"
    }
    );
    foreach my $scm ( @scminputs ) {
    my $scmName = $scm->{"name"};
    my $nixexpr = $scm->{"nixexpr"};
    my $type = $scm->{"type"};
    my $uri = $scm->{"uri"};
    my $update = $scm->{"update"};
    my $jobset = createJobsetWithOneInput($scmName, $nixexpr, "src", $type, $uri);
    my $state = 0;
    my $q = 0;
    my ($loop, $updated) = updateRepository($scmName, $update);
    while($loop) {
    my $c = 0;
    # Verify that it can be fetched and possibly queued.
    ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression."); $c++;
    # Verify that the evaluation has queued a new job and evaluate again to ...
    if ($updated) {
    $q++;
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
    ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression again."); $c++;
    }
    # ... check that it is deterministic and not queued again.
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
    $state++;
    ($loop, $updated) = updateRepository($scmName, $update, getcwd . "/$scmName-repo/");
    }
    }
    done_testing;