E2E Test Case: Large file storage (multipart upload + Range download)

A concrete, scripted end-to-end test case for magda-storage-api’s large-file support, run through the gateway with an API key. It builds on the shared setup in Feature-specific testing through the gateway with an API key β€” follow steps 1–3 there first to expose the gateway ($BASE) and obtain an API key (API_KEY_ID / API_KEY).

What it covers

magda-storage-api supports resumable large-file uploads via S3 multipart proxy endpoints and resumable/seekable downloads via HTTP Range on the existing GET /api/v0/storage/{bucket}/{path} route. The multipart endpoints are:

Key properties this case verifies:

Run the driver script

A driver script exercises the whole flow (initiate β†’ upload parts β†’ complete β†’ full + ranged download with checksum match β†’ abort). With $BASE reachable and an API key from the shared setup:

BASE_URL=$BASE/api/v0/storage API_KEY_ID=<API_KEY_ID> API_KEY=<API_KEY> \
  SIZE_MB=200 KEY="verify/large-file/e2e-$(date +%s).bin" \
  node magda-storage-api/scripts/verify-large-file.mjs

Expected output ends with ALL CHECKS PASSED.

The script’s auth is pluggable: pass API_KEY_ID + API_KEY (the real external path, recommended) or, for a quick internal check, JWT (an X-Magda-Session token). Other env vars: BUCKET (default magda-datasets), SIZE_MB (default 500), and KEY (the object key β€” use a fresh one per run).

Notes

Cleanup

The script deletes the object it uploads. Additionally, per the shared setup, restore the gateway service, stop minikube tunnel, and remove any throwaway test user / API key you created. Abandoned incomplete multipart uploads (if any) are cleaned up automatically by the bucket lifecycle rule after incompleteUploadExpiryDays.