Repository navigation
feat: add E2E sandbox tests and regenerate-iam endpoint - #25
Conversation
E2E Tests: - Add e2e-sandbox.test.ts that installs CLI from npm and tests - Update test workflow to run on PRs to dev and main - Test basic CLI commands, validation, and sandbox training Admin Endpoint: - Add POST /admin/regenerate-iam/:username endpoint - Regenerates IAM credentials for existing users - Restores access to all existing datasets - Useful for fixing IAM setup issues or rotating credentials API: - Add regenerateUserIam function to CLI API lib
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR25Version: 🤖 Updated on each push. |
- Fix config directory path (nemar-cli -> nemar) - Fix config key name (apiToken -> apiKey) - Add username to config for --mine filter - Simplify BIDS dataset to minimal valid structure
- Add Deno setup to e2e-sandbox job for BIDS validation - Add retry loop to wait for npm publish before installing - Add stderr output on test failures for debugging
- Limit sandbox datasets to 10MB total file size - Return 400 error if sandbox file size exceeds limit - Block DOI concept creation for sandbox datasets (xx prefix) - Block DOI version publishing for sandbox datasets - Sandbox datasets are for testing only, not real data storage
PR Review FindingsCritical Issues1. Silent workflow fallback to
2. Swallowed IAM revocation errors (
High Severity Issues3. Empty catch block in test cleanup (
4. Missing
Test Coverage Gaps5. New backend features lack API tests:
Positive Observations
|
ResolutionsAddressing the review findings: Fixed in this PR:
Deferred to follow-up:
Separate issue raised by user:
|
- Add warning annotation for workflow fallback to dev tag - Log actual error in test cleanup catch block - Add missing datasets_restored field to RegenerateIamResponse
- Add TEST_SANDBOX_DATASET_ID env var to target specific sandbox dataset - Add TEST_CREATE_SANDBOX env var to enable actual sandbox uploads - Add test for sandbox upload with xx prefix datasets - Default behavior remains dry-run only (safe for CI)
Summary
Changes
E2E Sandbox Tests (
test/e2e-sandbox.test.ts)Tests that install CLI from npm (PR tag or dev) and run:
nemar --versionand--helpnemar auth statusnemar dataset validateon sample BIDS datasetnemar dataset listand--minenemar sandbox --helpE2E Upload Tests (
test/e2e-upload.test.ts)TEST_SANDBOX_DATASET_IDenv var to target specific sandbox datasetTEST_CREATE_SANDBOXenv var to enable actual sandbox uploadsTest Workflow (
.github/workflows/test.yml)e2e-sandboxjob on PRsAdmin Endpoint (
backend/src/routes/admin.ts)POST /admin/regenerate-iam/:usernameSandbox Restrictions
backend/src/routes/datasets.ts)backend/src/routes/admin.ts)Related
Addresses items from #16
Test plan