diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2024-05-27 00:02:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-27 00:02:54 +0000 |
commit | 7b88bc39eff1636444e36783e5920104afb23f69 (patch) | |
tree | 435986bc4aaa7c81b2219d22fc7b645f287fa72d /pkgs/tools/networking/lychee/tests/fail-emptyDirectory.nix | |
parent | 7537b4081330a0b26db23c1b17a14b41bdd360fe (diff) | |
parent | d177a6c096aea44d6576e97fd1ec20bb0f7112ad (diff) |
Merge staging-next into staging
Diffstat (limited to 'pkgs/tools/networking/lychee/tests/fail-emptyDirectory.nix')
-rw-r--r-- | pkgs/tools/networking/lychee/tests/fail-emptyDirectory.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/tools/networking/lychee/tests/fail-emptyDirectory.nix b/pkgs/tools/networking/lychee/tests/fail-emptyDirectory.nix new file mode 100644 index 0000000000000..9db4b23b1bc96 --- /dev/null +++ b/pkgs/tools/networking/lychee/tests/fail-emptyDirectory.nix @@ -0,0 +1,28 @@ +{ runCommand, testers, emptyDirectory }: +let + sitePkg = runCommand "site" { } '' + dist=$out/dist + mkdir -p $dist + echo "<html><body><a href=\"https://example.com/foo\">foo</a></body></html>" > $dist/index.html + echo "<html><body></body></html>" > $dist/foo.html + ''; + check = testers.lycheeLinkCheck { + site = sitePkg + "/dist"; + remap = { + # Normally would recommend to append a subpath that hints why it's forbidden; see example in docs. + # However, we also want to test that a package is converted to a string *before* + # it's tested whether it's a store path. Mistake made during development caused: + # cannot check URI: InvalidUrlRemap("The remapping pattern must produce a valid URL, but it is not: /nix/store/4d0ix...empty-directory/foo + "https://example.com" = emptyDirectory; + }; + }; + + failure = testers.testBuildFailure check; +in + runCommand "link-check-fail" { inherit failure; } '' + # The details of the message might change, but we have to make sure the + # correct error is reported, so that we know it's not something else that + # went wrong. + grep 'empty-directory/foo.*Cannot find file' $failure/testBuildFailure.log >/dev/null + touch $out + '' |