Commit graph

49 commits

Author SHA1 Message Date
Graham Christensen b15d8edab1
tests: delete set-up.pl / tear-down.pl
We'll set these up on a per-test basis.
2021-02-23 21:12:06 -05:00
Graham Christensen 2240035e20
Run tests with yath
This will let us run tests in parallel, and creates a more Perl-standard
test development experience.
2021-02-19 17:04:19 -05:00
Maximilian Bosch efcbc08686
Get rid of dependency to SQLite
SQLite isn't properly supported by Hydra for a few years now[1], but
Hydra still depends on it. Apart from a slightly bigger closure this can
cause confusion by users since Hydra picks up SQLite rather than
PostgreSQL by default if HYDRA_DBI isn't configured properly[2]

[1] 78974abb69
[2] https://logs.nix.samueldr.com/nixos-dev/2020-04-10#3297342;
2020-04-16 00:42:40 +02:00
Eelco Dolstra 53e1294825 Fix Mercurial tests
In Nixpkgs 20.03, Mercurial fails if PYTHONPATH is set:

  $ hg
  Traceback (most recent call last):
    File "/nix/store/q7s856v6nw4dffdrm9k3w38qs35i8kr3-mercurial-5.2.2/bin/..hg-wrapped-wrapped", line 37, in <module>
      dispatch.run()
    File "/nix/store/bffdy7q3wi3qinflnvbdkigqj39zzynd-python3-3.7.6/lib/python3.7/importlib/util.py", line 245, in __getattribute__
      self.__spec__.loader.exec_module(self)
    File "<frozen importlib._bootstrap_external>", line 728, in exec_module
    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    File "/nix/store/q7s856v6nw4dffdrm9k3w38qs35i8kr3-mercurial-5.2.2/lib/python3.7/site-packages/mercurial/dispatch.py", line 10, in <module>
      import difflib
    File "/nix/store/bffdy7q3wi3qinflnvbdkigqj39zzynd-python3-3.7.6/lib/python3.7/difflib.py", line 1084, in <module>
      import re
    File "/nix/store/bffdy7q3wi3qinflnvbdkigqj39zzynd-python3-3.7.6/lib/python3.7/re.py", line 143, in <module>
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'

(cherry picked from commit 4009d4295e)
2020-03-31 22:19:19 +02:00
danbst 4171ab4c4f tests: change postgresql socket dir to /tmp
In https://github.com/NixOS/nixpkgs/pull/57677 default postgresql socket directory was changed
to `/run/postgresql`, which doesn't exist (and can't be created) in
Nix build environment. We'll use /tmp as socket dir explicitly then.

Fixes build failure https://hydra.nixos.org/build/91221682

Cc @aszlig @edolstra
2019-03-29 23:46:38 +02:00
Graham Christensen 4160132278 tests: disable sandbox
Prior, tests would all fail to build, causing, roughly, the following
error (roughly, because I added some debug log messages :)):

    ok 68 - Evaluating jobs/build-products.nix should result in 2 builds
    Queue runner stderr: using 4185024512 bytes for the NAR buffer
    locking path '/build/source/tests/data/queue-runner/lock'
    lock acquired on '/build/source/tests/data/queue-runner/lock.lock'
    warning: unknown setting 'max-connection-age'
    warning: unknown setting 'max-connections'
    dispatcher woken up
    dispatcher woken up
    dispatcher sleeping for 7674380800s
    adding new machine ‘localhost’
    dispatcher woken up
    checking the queue for builds > 0...
    dispatcher sleeping for 7674380800s
    sending notification about build 1
    loading build 18 (tests:build-products:simple)
    considering derivation ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’
    sending notification about build 2
    creating build step ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’
    added build 18 (top-level step /build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv, 1 new steps)
    got 1 new runnable steps from 1 new builds
    step ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’ is now runnable
    dispatcher woken up
    dispatcher sleeping for 7674380800s
    performing step ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’ 1 times on ‘localhost’ (needed by build 18
    and 0 others)
    sending closure of ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’ to ‘localhost’
    building ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’ on ‘localhost’
    killing process 10462
    marking build 18 as failed
    finishing build step ‘/build/source/tests/nix/store/24h0i450d4k00a4jhhk6r7qpqdvzskw6-build-product-simple.drv’

    ok 69 - Build 'simple' from jobs/build-products.nix should exit with code 0
    ok 70 - newbuild->finished was '1' instead of 1
    not ok 71 - newbuild->buildstatus was '1' instead of 0
    not ok 72 - Build 'simple' from jobs/build-products.nix should have buildstatus 0
    Can't call method "name" on an undefined value at ./evaluation-tests.pl line 173.
    FAIL: evaluation-tests.pl
2019-02-01 04:31:11 +01:00
Shea Levy c40077ece1 Fix tests 2017-05-24 10:00:38 -04:00
Eelco Dolstra e0b2921ff2 Concurrent hydra-evaluator
This rewrites the top-level loop of hydra-evaluator in C++. The Perl
stuff is moved into hydra-eval-jobset. (Rewriting the entire evaluator
would be nice but is a bit too much work.) The new version has some
advantages:

* It can run multiple jobset evaluations in parallel.

* It uses PostgreSQL notifications so it doesn't have to poll the
  database. So if a jobset is triggered via the web interface or from
  a GitHub / Bitbucket webhook, evaluation of the jobset will start
  almost instantaneously (assuming the evaluator is not at its
  concurrency limit).

* It imposes a timeout on evaluations. So if e.g. hydra-eval-jobset
  hangs connecting to a Mercurial server, it will eventually be
  killed.
2016-10-14 14:22:12 +02:00
Eelco Dolstra e94ef4627c Tests: Clear $NIX_REMOTE_SYSTEMS 2016-10-06 17:19:16 +02:00
Eelco Dolstra b5815e2aa6 Run PostgreSQL during "make check" 2015-06-25 16:47:39 +02:00
Eelco Dolstra 18a3c3ff1c Update "make check" for the new queue runner
Also, if the machines file contains an entry for localhost, then run
"nix-store --serve" directly, without going through SSH.
2015-06-25 16:47:39 +02:00
Eelco Dolstra c93ff1e817 Doh 2015-05-26 15:25:21 +02:00
Eelco Dolstra 8c2acdd294 make clean: Delete darcs-repo 2013-11-06 14:29:55 +00:00
Eelco Dolstra b47d9814e3 Clear $HYDRA_CONFIG in the tests
Otherwise one might accidentally send out HipChat notifications when
running the tests...
2013-07-19 14:42:34 +02:00
Eelco Dolstra 58dd49e645 Fix handling of IPC::Run::run exit status
Turns out that the exit status is returned in $?, not as the return
value of run().  So our error checking was completely bogus.
2013-01-23 15:56:28 +01:00
Eelco Dolstra 67aefde62c Remove trailing whitespace 2013-01-22 14:41:02 +01:00
Nicolas Pierron 69f9175986 Add tests for "git describe --long".
* Move test logic to scm-update.sh scripts.
    * Check for "git describe --long".
2012-04-29 20:59:43 -07:00
Eelco Dolstra 3f1bbf7ef4 Better fix 2012-03-12 21:06:42 +01:00
Eelco Dolstra 259afadbab Set $PERL5LIB properly in hydra-init in "make check" 2012-03-12 20:56:41 +01:00
Eelco Dolstra 541238030d Provide a command ‘hydra-init’ to initialise/upgrade the database
For schema upgrades, hydra-init executes the files
src/sql/upgrade-<N>.sql, each of which upgrades the schema from
version N-1 to N.  The upgrades are wrapped in a transaction.
2012-02-28 20:16:16 +01:00
Eelco Dolstra 12a7b5737d Test environment cleanups
In particular, clear $NIX_BUILD_HOOK to prevent tests
from failing mysteriously.  Also print stdout/stderr
output of hydra-evaluator.
2011-12-04 22:50:03 +01:00
Eelco Dolstra dd6e5d49ba Fix the test 2011-11-30 18:14:48 +01:00
Eelco Dolstra 82d17a2d0b Rename hydra_*.pl to hydra-*
The underscores are ugly and the .pl extension is an implementation
detail that shouldn't be visible to the outside.

Also, get rid of the *.in files.  It's not really necessary to
generate them.  And I was always modifying the wrong file.
2011-11-30 18:14:48 +01:00
Rob Vermaas a9f422dcff add NIX_MANIFESTS_DIR to tests 2011-04-19 11:55:49 +00:00
Rob Vermaas 385b70c898 hydra: fixed and re-enabled evaluation tests 2011-03-24 13:45:01 +00:00
Rob Vermaas 2c9be852cb disabled evaluation tests until i figure out why it fails in buildfarm and succeeds locally 2011-03-21 12:36:01 +00:00
Rob Vermaas 9f33d4c98d 2011-03-17 13:25:27 +00:00
Rob Vermaas bf2f86d3c6 show evaluation errors in log of tests 2011-03-17 10:29:01 +00:00
Rob Vermaas ea4ae11353 set BZR_HOME env var so bzr won't fail 2011-03-17 09:14:48 +00:00
Rob Vermaas 4b599f4dfc set BZR_HOME env var so bzr won't fail 2011-03-17 09:04:07 +00:00
Rob Vermaas 369b2ef0aa add tests for scm inputs 2011-03-17 08:48:27 +00:00
Rob Vermaas 98c8a86886 add bzr-repo target 2011-03-17 07:55:44 +00:00
Rob Vermaas 019e273bbb remove debug target 2011-03-17 07:43:55 +00:00
Rob Vermaas 50c7629efc nix needs env vars as absolute paths 2011-03-17 07:43:33 +00:00
Rob Vermaas f34636c15f make sure jobs/* and Setup.pm is in tarball 2011-03-17 07:30:19 +00:00
Rob Vermaas fa8c91ed91 use abs_builddir for svn checkout 2011-03-17 07:25:23 +00:00
Ludovic Courtès cf0a6a5fc7 tests: $(topsrc_dir) -> $(top_srcdir). 2011-03-16 16:18:59 +00:00
Ludovic Courtès 87c556e6ea tests: Use $(builddir) instead of pwd. 2011-03-16 16:18:56 +00:00
Ludovic Courtès 72fdede0e0 tests: Add $(srcdir) to Perl's module search path. 2011-03-16 16:18:53 +00:00
Rob Vermaas 11b6f9cf35 2011-03-16 14:00:52 +00:00
Rob Vermaas faf128a55b add target to make simple git/hg/svn inputs 2011-03-16 13:36:42 +00:00
Rob Vermaas 890a7867b4 add first evaluations tests 2011-03-16 13:18:12 +00:00
Rob Vermaas 4f50af18aa 2011-03-16 10:50:50 +00:00
Rob Vermaas b0283aa404 2011-03-16 10:46:43 +00:00
Rob Vermaas aa27906150 add local srcdir to perl5lib env var 2011-03-16 10:41:31 +00:00
Rob Vermaas 65e4122444 2011-03-16 10:27:32 +00:00
Rob Vermaas 6b0da4625f setup environment variables for tests 2011-03-16 09:46:47 +00:00
Rob Vermaas 9716152ecf use top_srcdir in stead of srcdir 2011-03-16 09:24:18 +00:00
Rob Vermaas 0df0723b46 first test, not yet in buildprocess 2011-03-16 08:50:31 +00:00