From a57d76cceb3bbb279192de38d0cf31f2ac72021b Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:42:13 -0800 Subject: [PATCH] docs: gwc info added to DEVELOPER-NOTES.md --- DEVELOPER-NOTES.md | 25 +++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 DEVELOPER-NOTES.md diff --git a/DEVELOPER-NOTES.md b/DEVELOPER-NOTES.md new file mode 100644 index 0000000..2fbc72e --- /dev/null +++ b/DEVELOPER-NOTES.md @@ -0,0 +1,25 @@ +# Developer notes + + + +## Gateway Conformance testing + +We have some code enabled that makes running gateway-conformance testing against helia-http-gateway easy. Follow the instructions in this section to run gateway-conformance tests locally + +### Prerequisites + +1. [Install docker](https://docs.docker.com/get-docker/) +2. [Install nodejs](https://nodejs.org/en/download/) + +### Run gateway-conformance tests locally + +```sh +$ npm run test:gwc +``` + +### Some callouts + +1. The file `./scripts/kubo-init.js` executes kubo using `execa` instead of `ipfsd-ctl` so there may be some gotchas, but it should be as cross-platform and stable as the `execa` library. +1. The IPFS_PATH used is a temporary directory. Your OS should handle removing it when vital, but you can also remove it manually. The path to this directory is printed out when the tests start, and saved in a file at `./scripts/tmp/kubo-path.txt`. +1. The tests save gateway-conformance fixtures to `./scripts/tmp/fixtures`. You can remove this directory manually if you want to re-run the tests with a fresh set of fixtures. +1. The results of the gateway-conformance tests are saved to `./gwc-report.json`. This file is overwritten every time the tests are run. diff --git a/package.json b/package.json index 6061c50..5ec89bd 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "test:e2e-doctor": "concurrently -k -s all -n \"gateway,playwright\" -c \"magenta,blue\" \"npm run start:dev-doctor\" \"wait-on 'tcp:$PORT' && npm run test:e2e\"", "test:gwc-kubo": "node ./scripts/kubo-init.js", "test:gwc-helia": "npm run build && USE_LIBP2P=false PORT=8090 TRUSTLESS_GATEWAY='http://127.0.0.1:8080' npm start", - "test:gwc-execute": "docker run --network host -v $PWD:/workspace -w /workspace ghcr.io/ipfs/gateway-conformance:v0.4.2 test --gateway-url http://localhost:8090 --json report.json --specs -path-ipns-gateway,-trustless-block-gateway,-trustless-car-gateway,-trustless-car-gateway-optional,-trustless-ipns-gateway,-trustless-gateway,-subdomain-gateway,-redirects-file -- -timeout 30m", + "test:gwc-execute": "docker run --network host -v $PWD:/workspace -w /workspace ghcr.io/ipfs/gateway-conformance:v0.4.2 test --gateway-url http://localhost:8090 --json gwc-report.json --specs -path-ipns-gateway,-trustless-block-gateway,-trustless-car-gateway,-trustless-car-gateway-optional,-trustless-ipns-gateway,-trustless-gateway,-subdomain-gateway,-redirects-file -- -timeout 30m", "test:gwc": "concurrently -k -s all -n \"kubo,helia,gateway-conformance\" -c \"magenta,blue,green\" \"npm run test:gwc-kubo\" \"wait-on 'tcp:8080' && npm run test:gwc-helia\" \"wait-on 'tcp:8090' && npm run test:gwc-execute\"", "test:gateway-conformance": "TRUSTLESS_GATEWAY='http://localhost:8080' echo 'gateway conformance'", "healthcheck": "node dist/src/healthcheck.js",