diff options
author | Florian Klink <flokli@flokli.de> | 2024-04-22T13·51+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-04-23T12·41+0000 |
commit | dfef3d18d177bbeadcc3000cc39ef0a16a566a1f (patch) | |
tree | 2eb7d5e5b5121d36e3557b4392e36ea70e023932 /tvix/glue/src/tests/tvix_tests/eval-okay-fetchtarball.nix | |
parent | 30950833c943c6b6b48d204ab0027f38af356f5c (diff) |
test(tvix/glue): add tests for fetchurl and fetchTarball r/7995
Change-Id: I53a0590ecf4e5fcb1bfd1d127824211338e28256 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11503 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/glue/src/tests/tvix_tests/eval-okay-fetchtarball.nix')
-rw-r--r-- | tvix/glue/src/tests/tvix_tests/eval-okay-fetchtarball.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tvix/glue/src/tests/tvix_tests/eval-okay-fetchtarball.nix b/tvix/glue/src/tests/tvix_tests/eval-okay-fetchtarball.nix new file mode 100644 index 000000000000..e454f1244404 --- /dev/null +++ b/tvix/glue/src/tests/tvix_tests/eval-okay-fetchtarball.nix @@ -0,0 +1,42 @@ +[ + # (fetchTarball "url") cannot be tested, as that one has to fetch from the + # internet to calculate the path. + + # with url and sha256 + (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/91050ea1e57e50388fa87a3302ba12d188ef723a.tar.gz"; + sha256 = "1hf6cgaci1n186kkkjq106ryf8mmlq9vnwgfwh625wa8hfgdn4dm"; + }) + + # with url and sha256 (as SRI) + (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/91050ea1e57e50388fa87a3302ba12d188ef723a.tar.gz"; + sha256 = "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE="; + }) + + # with another url, it actually doesn't matter (no .gz prefix) + (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/91050ea1e57e50388fa87a3302ba12d188ef723a.tar"; + sha256 = "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE="; + }) + + # also with an entirely different url, it doesn't change + (builtins.fetchTarball { + url = "https://test.example/owo"; + sha256 = "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE="; + }) + + # … because `name` defaults to source, and that (and the sha256 affect the store path) + (builtins.fetchTarball { + name = "source"; + url = "https://test.example/owo"; + sha256 = "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE="; + }) + + # … so changing name causes the hash to change. + (builtins.fetchTarball { + name = "some-name"; + url = "https://test.example/owo"; + sha256 = "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE="; + }) +] |