Add test to verify includes work

[?]
Jul 26, 2021, 5:13 PM
HXEZUCTD7T3YUT3XKWQOWRFSADNFZT2EYXHOATIBXWTNACDHNQQQC

Dependencies

  • [2] 4QI6G7YB tests: replace the flat list of contexts with a hash
  • [3] 5DXGOH6Q statsd: add a chance to set hostname and port in hydra.conf
  • [4] DNOLOMX7 hydra-send-stats: add a failing test asserting it can run
  • [5] 4Y3LBQYI Use system-features from the Nix conf in the default machine file
  • [6] 2I3HFWBK tests: Make the external destination store optional
  • [7] 6HYCG3DC tests: allow specifying some nix config
  • [8] 3AKZKWCR RunCommand: Test
  • [9] U2PHPVGD t/Setup.pm: sort NIX_ env vars
  • [10] HX4QYOYA add first evaluations tests
  • [11] C66VQYWT Run the tests with a remote dest store
  • [12] OWRS526H Create an ephemeral PostgreSQL database per test
  • [13] HUCBINMQ Only add the Nix system feature to the test that requires it
  • [14] YIZWKGFI tests: add jobsdir and testdir to ctx hash
  • [15] UIA3ULNU Give each test its own Nix directories
  • [16] 4WLW4VHS Test setup: support arbitrary hydra config
  • [17] HE3GX5IP Optimize fetch-git.
  • [18] FAIJDQKZ

Change contents

  • file addition: include.t (----------)
    [3.986]
    use strict;
    use Setup;
    my %ctx = test_init(
    use_external_destination_store => 0,
    hydra_config => "include foo.conf"
    );
    write_file($ctx{'tmpdir'} . "/foo.conf", q|
    <foo>
    include bar.conf
    </foo>
    |);
    write_file($ctx{'tmpdir'} . "/bar.conf", q|
    bar = baz
    |);
    require Hydra::Helper::Nix;
    use Test2::V0;
    is(Hydra::Helper::Nix::getHydraConfig(), {
    foo => { bar => "baz" }
    }, "Nested includes work.");
    done_testing;
  • replacement in t/lib/Setup.pm at line 12
    [7.587][4.0:79]()
    our @EXPORT = qw(test_init hydra_setup nrBuildsForJobset queuedBuildsForJobset
    [7.587]
    [4.79]
    our @EXPORT = qw(test_init hydra_setup write_file nrBuildsForJobset queuedBuildsForJobset
  • replacement in t/lib/Setup.pm at line 52
    [7.1767][7.1767:1878](),[5.1718][7.57:98](),[7.1878][7.57:98](),[7.98][7.1878:1893](),[7.1878][7.1878:1893](),[7.1893][7.872:873]()
    open(my $fh, '>', $nixconf) or die "Could not open file '$nixconf' $!";
    print $fh "sandbox = false\n";
    print $fh $opts{'nix_config'} || "";
    close $fh;
    [7.1767]
    [7.873]
    my $nix_config = "sandbox = false\n" . $opts{'nix_config'};
    write_file($nixconf, $nix_config);
  • replacement in t/lib/Setup.pm at line 56
    [7.1894][7.920:1026]()
    open(my $fh, '>', $ENV{'HYDRA_CONFIG'}) or die "Could not open file '" . $ENV{'HYDRA_CONFIG'}. " $!";
    [7.1894]
    [6.0]
    my $hydra_config = $opts{'hydra_config'} || "";
  • replacement in t/lib/Setup.pm at line 58
    [6.56][6.56:115]()
    print $fh "store_uri = file:$dir/nix/dest-store\n"
    [6.56]
    [6.115]
    $hydra_config = "store_uri = file:$dir/nix/dest-store\n" . $hydra_config;
  • replacement in t/lib/Setup.pm at line 60
    [7.56][7.1026:1084](),[6.121][7.1026:1084](),[7.1026][7.1026:1084]()
    print $fh $opts{'hydra_config'} || "";
    close $fh;
    [6.121]
    [7.1084]
    write_file($ENV{'HYDRA_CONFIG'}, $hydra_config);
  • edit in t/lib/Setup.pm at line 80
    [2.137]
    [7.915]
    }
    sub write_file {
    my ($path, $text) = @_;
    open(my $fh, '>', $path) or die "Could not open file '$path' $!";
    print $fh $text || "";
    close $fh;