Skip to content

Commit

Permalink
Add test to ensure no special handling of hydraJobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jbgi committed May 31, 2023
1 parent 9e0a97e commit 180473d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
56 changes: 56 additions & 0 deletions examples/check-utils/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion examples/check-utils/flake.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
{
description = "Flake utils demo";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.url = "path:../..";

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (flake-utils.lib.check-utils system) isEqual hasKey;
testDataset = { key1 = "value1"; key2 = 123; key3 = "some>value with^invalid&characters"; };
mkHydraJobs = system: {
toplevel = derivation { name = "toplevel"; builder = "mybuilder"; inherit system; };
nested = {
attribute = derivation { name = "nested-attribute"; builder = "mybuilder"; inherit system; };
};
};
in
rec {
hydraJobs = mkHydraJobs system;
checks = {
# Successful cases
success_isEqual = isEqual testDataset.key1 "value1";
success_hasKey = hasKey testDataset "key2";
# ensure no special handling of hydraJobs
success_hydraJobs = isEqual self.hydraJobs (flake-utils.lib.eachDefaultSystemMap mkHydraJobs);

# Failing cases
failure_isEqual = isEqual testDataset.key1 "failing-data";
Expand Down

0 comments on commit 180473d

Please sign in to comment.