Commit graph

3304 commits

Author SHA1 Message Date
Graham Christensen a8ec1b1afa
Merge pull request #884 from cole-h/perl-cleanup
tests: replace the flat list of contexts with a hash
2021-03-05 12:45:21 -05:00
Cole Helbling 014778344c
tests: remove unnecessary Cwd imports 2021-03-04 23:48:48 -08:00
Cole Helbling 9a3af13c51
tests: add jobsdir and testdir to ctx hash
This allows us to calculate those directories only once, and just pass
them around as necessary.
2021-03-04 23:19:48 -08:00
Graham Christensen f08d0be1bd
tests: replace the flat list of contexts with a hash
This way we can return more values without breaking callers.
2021-03-04 23:11:54 -08:00
Graham Christensen 26cfe624d5
Merge pull request #882 from cole-h/split-inputtype-test
tests/input-types: split out scminputs into individual tests
2021-03-04 17:13:22 -05:00
Cole Helbling 387fe8005a
tests/input-types: split out scminputs into individual tests
This makes the test faster (by removing it and replacing it with a
`TestScmInput` module that exports the `testScmInput` subroutine). Now,
all the input tests can be run in parallel.

Some of the `tests/jobs/*-update.sh` scripts were "broken" (e.g. tests
failed for various reasons on my machine), so I fixed those up as well.

Co-authored-by: gustavderdrache <gustavderdrache@gmail.com>
2021-03-04 13:58:48 -08:00
Graham Christensen 572a0c0abd
Merge pull request #881 from cole-h/hydra-dbi
module: append `application_name` to HYDRA_DBI
2021-03-04 10:07:01 -05:00
Cole Helbling fe70160008
module: append application_name to HYDRA_DBI
This will make it easier to track specifically where queries are being
made from (assuming a `log_line_prefix` that includes `%a` in the
postgres configuration).
2021-03-03 16:02:52 -08:00
Graham Christensen 68ac64dbd9
Merge pull request #832 from wizeman/fix-hash-mismatch
Fix persistent hash mismatch errors when importing
2021-03-02 16:04:23 -05:00
Eelco Dolstra 3cd312fc4c
Merge pull request #879 from grahamc/runcommand-meta
RunCommand: pass homepage, description, license, system, and nixname
2021-02-25 09:59:19 +01:00
Graham Christensen a756614fa1
RunCommand: pass homepage, description, license, system, and nixname 2021-02-24 16:13:09 -05:00
Eelco Dolstra 6fb9a2bbf5
Merge pull request #878 from grahamc/test-runcommand
Test RunCommand's behavior
2021-02-24 21:42:14 +01:00
Graham Christensen 3fda37f65a
RunCommand: Test 2021-02-24 13:43:25 -05:00
Graham Christensen b2520267a9
Test setup: support arbitrary hydra config 2021-02-24 11:44:16 -05:00
Graham Christensen 8d3633594b
Merge pull request #876 from grahamc/per-test-db
Create an ephemeral PostgreSQL database and Nix store per test, split up tests.
2021-02-24 07:59:18 -05:00
Graham Christensen cccdc70162
input-types.t: don't litter ./tests/ 2021-02-24 07:01:32 -05:00
Graham Christensen 611d7b71f2
input-types: use is() for test comparisons 2021-02-24 07:01:32 -05:00
Graham Christensen 371826f931
Tests: build-products: use is for good errors on failures 2021-02-24 07:01:32 -05:00
Graham Christensen 0df9c68422
Relocate the final evalutation tests to a build-products specific test. 2021-02-24 07:01:31 -05:00
Graham Christensen 2776ae6c78
Move tests for SCM inputs in to its own .t 2021-02-24 07:01:31 -05:00
Graham Christensen c8df544046
evaluate-dependent-jobsets: clean up test to be more clear 2021-02-24 07:01:31 -05:00
Graham Christensen 0b693ad8e8
Use is in evaluate-dependent-jobsets 2021-02-24 07:01:31 -05:00
Graham Christensen 9590bababc
Split out dependent tests in to its own .t 2021-02-24 07:01:25 -05:00
Graham Christensen e4cda87b5a
db.hh: use hasPrefix for prefix comparisons
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-02-24 07:00:26 -05:00
Graham Christensen 62b2880dfc
Give each test its own Nix directories
Otherwise we risk tripping over confusing statuses where a build is
"done" and "Cached", but we were expecting to run it.
2021-02-23 21:43:54 -05:00
Graham Christensen fe1f2f0806
Create an ephemeral PostgreSQL database per test 2021-02-23 21:12:06 -05:00
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 9ddc6e355f
flake: add TestPostgreSQL for per-test DBs 2021-02-23 21:12:02 -05:00
Graham Christensen bfcc50f978
Merge pull request #877 from immae/mdbook
Convert documentation to markdown / mdbook
2021-02-23 20:16:33 -05:00
Ismaël Bouya bd64b2481d
Remove old files 2021-02-24 01:07:11 +01:00
Ismaël Bouya 9d916877fb
Add markdown files for documentation
projects.xml and declarative-projects.xml were merged with xmllint, and
then I ran that to convert files
for i in *.xml; do pandoc -s -f docbook -t markdown $i -o ${i/xml/md}; done
2021-02-24 01:07:00 +01:00
Graham Christensen e16388e34a
Merge pull request #872 from grahamc/yath
Use `yath` for testing Hydra
2021-02-23 17:33:26 -05:00
Graham Christensen 3ebcaef127
README: update with instructions on running tests 2021-02-23 17:26:56 -05:00
Eelco Dolstra e072c1d741
Merge pull request #874 from regnat/remove-sendDerivation
Remove the `sendDerivation` logic from the builder
2021-02-23 13:07:03 +01:00
regnat f602ed0d86 Remove the sendDerivation logic from the builder
The queue runner used to special-case `localhost` as a remote builder:
Rather than using the normal remote-build (using the
`cmdBuildDerivation` command), it was using the (generally less
efficient, except when running against localhost) `cmdBuildPaths`
command because the latter didn't require a privileged Nix user (so made
testing easier − allowing to run hydra in a container in particular).

However:
1. this means that the build loop can follow two discint code paths depending
   on the setup, the irony being that the most commonly used one in production
   (the “non-localhost” case) isn't the one used in the testsuite (because all
   the tests run against a local store);
2. It turns out that the “localhost” version is buggy in relatively obvious
   ways − in particular a failure in a fixed-output derivation or a hash
   mismatch isn't reported properly;
3. If the “run in a container” use-case is indeed that important, it can be
   (partially) restored using a chroot store (which wouldn't behave excactly
   the same way of course, but would be more than good-enough for testing)
2021-02-23 09:50:15 +01:00
Eelco Dolstra 107d60027f hydra-eval-jobs: Fix unexpected EOF when a top-level attr fails 2021-02-22 16:29:07 +01:00
Eelco Dolstra a7d8ee98da Fix build 2021-02-22 15:10:24 +01:00
Eelco Dolstra 34b438ab6e flake.lock: Update
Flake input changes:

* Updated 'nix': 'github:NixOS/nix/8a2ce0f455da32bc20978e68c0aad9efb4560abc' -> 'github:NixOS/nix/548437c2347159c4c79352283dd12ce58324f1d6'
* Removed 'nix/lowdown-src'
2021-02-22 15:03:20 +01:00
Graham Christensen 45d9a22d73
flake.nix: add perlPackages until they're available from nixpkgs
These packages were added to Nixpkgs in https://github.com/NixOS/nixpkgs/pull/113702.
2021-02-19 17:06:49 -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
Eelco Dolstra a39b479280
Merge pull request #866 from Infinisil/github-status-flakes
Fix Github status plugin for flakes
2021-02-16 17:00:46 +01:00
Christian Kögler 150213cbb3 Fix login if Hydra runs behind HTTP proxy with sub-path location 2021-02-07 19:18:29 +01:00
Silvan Mosberger 58dd7f9ed3
Fix Github status plugin for flakes
If the root flake is a github: one, github status notifications are sent
to it. The githubstatus->inputs configuration isn't used for flakes.
2021-02-06 00:02:30 +01:00
Graham Christensen d8a5892795
Merge pull request #856 from immae/fix_check_jobsets
Fix check in jobsets
2021-02-03 16:25:18 -05:00
Ismaël Bouya 339a09f2e4
Fix check in jobsets
The current check happening in jobsets is incorrect.
The wanted constraint is stated as follow :
- If type is 0 (legacy), then the flake field should be null, and
  both nixExprInput and nixExprPath should be non-null
- If type is 1 (flake), then the flake field should be non-null, and
  both nixExprInput and nixExprPath should be null

The current version will not catch (i.e. it will accept) situations
where you have for instance :
type = 1, nixExprPath null, nixExprInput non-null, flake non-null

This commit fixes that.

I split(ted) that into two constraints, to make it more readable and
easier to extend if a new type appears in the future.

The complete query could be instead :
( type = 0
  AND nixExprInput IS NOT NULL AND nixExprPath IS NOT NULL AND flake IS NULL )
OR ( type = 1
  AND nixExprInput IS NULL AND nixExprPath IS NULL AND flake IS NOT NULL )

(but an "OR" cannot be split, hence the other formulation)
2021-02-03 22:14:53 +01:00
Graham Christensen bc12fe19f9
Merge pull request #855 from grahamc/jobsetevals-fixups
JobsetEvals: fixup permission references
2021-02-02 11:04:18 -05:00
Graham Christensen 6de9c6540c
Merge pull request #858 from Infinisil/fix-declarative-flakes
Fix transition from declarative non-flake to flake jobset
2021-02-02 11:04:05 -05:00
Graham Christensen ac80843e31
Merge pull request #860 from grahamc/eval-error-table
Move evaluation errors from evaluations to EvaluationErrors, a new table
2021-02-02 10:37:04 -05:00
Graham Christensen f1e75c8bff
Move evaluation errors from evaluations to EvaluationErrors, a new table
DBIx likes to eagerly select all columns without a way to really tell
it so. Therefore, this splits this one large column in to its own
table.

I'd also like to make "jobsets" use this table too, but that is on hold
to stop the bleeding caused by the extreme amount of traffic this is
causing.
2021-02-01 21:33:14 -05:00
Silvan Mosberger 1d45b63516
Fix transition from declarative non-flake to flake jobset
The database has these constraints:

    check ((type = 0) = (nixExprInput is not null and nixExprPath is not null)),
    check ((type = 1) = (flake is not null)),

which prevented switching to flakes in a declarative jobspec, since the
nixexpr{path,input} fields were not nulled in such an update

Co-Authored-By: Graham Christensen <graham@grahamc.com>
2021-02-01 18:57:40 +01:00