Merge pull request #59 from nix-community/test-nested-jobs

Add test for a job with a nested attrset
This commit is contained in:
adisbladis 2022-04-22 16:00:56 +07:00 committed by GitHub
commit 2e3405f2d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 9 deletions

View file

@ -1,7 +1,9 @@
let
pkgs = import (builtins.getFlake (toString ./.)).inputs.nixpkgs { };
in
{ pkgs ? import (builtins.getFlake (toString ./.)).inputs.nixpkgs { } }:
{
builtJob = pkgs.writeText "job1" "job1";
substitutedJob = pkgs.hello;
nested = {
job = pkgs.hello;
};
}

View file

@ -6,9 +6,6 @@
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
hydraJobs = {
builtJob = pkgs.writeText "job1" "job1";
substitutedJob = pkgs.hello;
};
hydraJobs = import ./ci.nix { inherit pkgs; };
};
}

View file

@ -23,7 +23,7 @@ def common_test(extra_args: List[str]) -> None:
)
results = [json.loads(r) for r in res.stdout.split("\n") if r]
assert len(results) == 2
assert len(results) == 3
built_job = results[0]
assert built_job["attr"] == "builtJob"
@ -32,7 +32,11 @@ def common_test(extra_args: List[str]) -> None:
assert built_job["drvPath"].endswith(".drv")
assert built_job["meta"]['broken'] is False
substituted_job = results[1]
nested_job = results[1]
assert nested_job["attr"] == "nested.job"
assert nested_job["name"].startswith("hello-")
substituted_job = results[2]
assert substituted_job["attr"] == "substitutedJob"
assert substituted_job["name"].startswith("hello-")
assert substituted_job["meta"]['broken'] is False