From ae663087b77e25a044a6364c94e75f176ca3f16f Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Thu, 31 Aug 2023 03:53:48 -0400 Subject: [PATCH] test(gateway-conformance): also run gateway conformance tests against a gateway-over-libp2p endpoint --- .github/workflows/gateway-conformance.yml | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/gateway-conformance.yml b/.github/workflows/gateway-conformance.yml index 928d51c7007b..0f70668472ff 100644 --- a/.github/workflows/gateway-conformance.yml +++ b/.github/workflows/gateway-conformance.yml @@ -60,6 +60,7 @@ jobs: run: | ./ipfs init ./ipfs config --json Gateway.PublicGateways "$GATEWAY_PUBLIC_GATEWAYS" + ./ipfs config --json Experimental.Libp2pStreamMounting true working-directory: kubo-gateway/cmd/ipfs # 4. Populate the Kubo gateway with the gateway-conformance fixtures @@ -115,3 +116,51 @@ jobs: with: name: gateway-conformance.json path: output.json + + # 8. Setup a kubo http-p2p-proxy to run gateway conformance tests + - name: Init p2p-proxy kubo node + env: + IPFS_PATH: "~/.kubo-p2p-proxy" + run: | + ./ipfs init --profile=randomports + ./ipfs config --json Experimental.Libp2pStreamMounting true + ./ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/8081" + working-directory: kubo-gateway/cmd/ipfs + + # 9. Start the kubo http-p2p-proxy and setup the forwarder + - name: Start kubo-gateway + env: + IPFS_PATH: "~/.kubo-p2p-proxy" + run: | + gatewayNodeId=$(ipfs id -f="" --api=/ip4/127.0.0.1/tcp/5001) + ./ipfs daemon --offline & + ./ipfs p2p forward --allow-custom-protocol /http/1.1 /ip4/127.0.0.1/tcp/8082 /p2p/$gatewayNodeId + working-directory: kubo-gateway/cmd/ipfs + + # 10. Run the gateway-conformance tests + - name: Run gateway-conformance tests over libp2p + uses: ipfs/gateway-conformance/.github/actions/test@v0.3 + with: + gateway-url: http://127.0.0.1:8081 + json: output.json + xml: output.xml + html: output.html + markdown: output.md + args: --specs "trustless-gateway,-trustless-ipns-gateway" -skip 'TestGatewayCar/GET_response_for_application/vnd.ipld.car/Header_Content-Length' + + # 11. Upload the results + - name: Upload MD summary + if: failure() || success() + run: cat output.md >> $GITHUB_STEP_SUMMARY + - name: Upload HTML report + if: failure() || success() + uses: actions/upload-artifact@v3 + with: + name: gateway-conformance-libp2p.html + path: output.html + - name: Upload JSON report + if: failure() || success() + uses: actions/upload-artifact@v3 + with: + name: gateway-conformance-libp2p.json + path: output.json \ No newline at end of file