gunk-dev/the-valley

web-push-e2e.nix

source8ffa911ee306main's published tip history
1.6 KiB
1# End-to-end check for the web push path using the packaged binaries:
2# valley-web-publish, valley-web-receive, and valley-web as built and
3# wrapped by nix/packages.nix (with their pinned tools and schemas),
4# the packaged valley CLI (valley-script, unstamped so commits alone do
5# not trigger a rebuild), and git.
6#
7# The test creates a valley instance that grants anyone read access to
8# two projects in one group. It verifies that:
9# 1. valley-web-publish uploads both projects to valley-web-receive,
10# and valley-web serves them at their group URLs and redirects a
11# short alias and a former name with 308.
12# 2. An upload with a wrong token fails as unauthenticated while
13# valley-web continues serving the previous export.
14# 3. Withdrawing a project's read grant removes the project on the
15# next pass.
16# 4. Both servers preserve the active export across a restart.
17# 5. When the receiver is stopped, valley-web continues serving, a
18# pass fails because the upload cannot connect, and the next pass
19# after the receiver restarts applies the withdrawal.
20#
21# The check runs inside the Nix build sandbox as a single user. The
22# separation between the receiver's user and valley-web's user is
23# checked by module-eval and web-image.
24{
25 pkgs,
26 packages,
27 ...
28}:
29{
30 web-push-e2e = pkgs.runCommand "valley-web-push-e2e" {
31 nativeBuildInputs = [
32 pkgs.git
33 pkgs.cue
34 pkgs.curl
35 pkgs.jq
36 packages.valley-script
37 packages.valley-web-publish
38 packages.valley-web-receive
39 packages.valley-web
40 ];
41 schema = ../../schema/valley.cue;
42 } (builtins.readFile ./web-push-e2e.sh);
43}