| 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 sends an authorization and uploads both |
| 10 | # projects to valley-web-receive, which makes the store's descriptor |
| 11 | # and its v2 payload directory, and valley-web serves them at their |
| 12 | # group URLs and redirects a short alias and a former name with 308. |
| 13 | # The pages say when the policy was last checked, and a pass with |
| 14 | # nothing changed sends no content but a newly signed authorization, |
| 15 | # whose later check the pages show, while export.json keeps its |
| 16 | # bytes. A replayed authorization, a forged one, and a manifest of the |
| 17 | # first protocol are refused, and valley-web refuses the directory the |
| 18 | # first store layout took as its state. |
| 19 | # 2. An upload with a wrong token fails as unauthenticated while |
| 20 | # valley-web continues serving the previous export. |
| 21 | # 3. Withdrawing a project's read grant removes the project on the |
| 22 | # next pass. A --policy-only pass withdraws a project while a |
| 23 | # content upload is stalled on the receiver's activation lock: the |
| 24 | # next request to valley-web, not restarted, no longer serves it; the |
| 25 | # stalled upload, whose export still holds the project, activates |
| 26 | # later and restores nothing; the receiver deletes the project's |
| 27 | # repository, and the active export.json keeps its bytes. Removing |
| 28 | # the stored authorization serves no project. Granting the project |
| 29 | # again sends its bundle again. |
| 30 | # 4. Both servers preserve the active export across a restart. |
| 31 | # 5. When the receiver is stopped, valley-web continues serving, a |
| 32 | # pass fails because it cannot send its authorization, and the next |
| 33 | # pass after the receiver restarts signs a new authorization, with a |
| 34 | # later sequence, that applies the withdrawal. |
| 35 | # |
| 36 | # The check runs inside the Nix build sandbox as a single user. The |
| 37 | # separation between the receiver's user and valley-web's user is |
| 38 | # checked by module-eval and web-image. |
| 39 | { |
| 40 | pkgs, |
| 41 | packages, |
| 42 | ... |
| 43 | }: |
| 44 | { |
| 45 | web-push-e2e = pkgs.runCommand "valley-web-push-e2e" { |
| 46 | nativeBuildInputs = [ |
| 47 | pkgs.git |
| 48 | pkgs.cue |
| 49 | pkgs.curl |
| 50 | pkgs.jq |
| 51 | pkgs.util-linux |
| 52 | packages.valley-script |
| 53 | packages.valley-web-publish |
| 54 | packages.valley-web-receive |
| 55 | packages.valley-web |
| 56 | ]; |
| 57 | schema = ../../schema/valley.cue; |
| 58 | } (builtins.readFile ./web-push-e2e.sh); |
| 59 | } |