Skip to content

Commit 3a345cf

Browse files
committed
refactor: remove DynamoDB (v2) integration tests
DynamoDB backend is no longer needed - PostgreSQL is the sole backend. - Remove test/it/dynamo/ (harness, setup, seed data, wiring files) - Simplify env.js to only build PostgreSQL env vars - Update CLAUDE.md to reflect PostgreSQL-only IT setup - Remove it-dynamo input from CI workflow
1 parent ae46034 commit 3a345cf

44 files changed

Lines changed: 20 additions & 1537 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ jobs:
1818
service-name: api-service
1919
validate-pr-title: true
2020
docs-lint: true
21-
it-dynamo: true
2221
it-postgres: true
2322
secrets: inherit

CLAUDE.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ npx mocha test/path/to/specific.test.js -g "pattern" # Run tests matching patter
2323

2424
### Integration Tests
2525
```bash
26-
# DynamoDB suite (requires Java 17+)
27-
npx mocha --require test/it/dynamo/harness.js --timeout 30000 'test/it/dynamo/**/*.test.js'
28-
2926
# PostgreSQL suite (requires Docker + ECR access)
3027
npx mocha --require test/it/postgres/harness.js --timeout 30000 'test/it/postgres/**/*.test.js'
3128

3229
# Single IT test file
33-
npx mocha --require test/it/dynamo/harness.js --timeout 30000 test/it/dynamo/sites.test.js
30+
npx mocha --require test/it/postgres/harness.js --timeout 30000 test/it/postgres/sites.test.js
3431
```
3532

3633
### Documentation
@@ -62,7 +59,7 @@ Request → AWS Lambda → Middleware Stack → Route Matcher → Controller →
6259
**Middleware Stack** (in order, defined in `src/index.js`):
6360
1. `authWrapper` - Authentication (JWT, IMS, API Keys, Scoped API Keys)
6461
2. `logWrapper` - Structured logging
65-
3. `dataAccess` - DynamoDB access layer (`@adobe/spacecat-shared-data-access`)
62+
3. `dataAccess` - Data access layer (`@adobe/spacecat-shared-data-access`)
6663
4. `bodyData` - Request body parsing
6764
5. `multipartFormData` - File upload handling
6865
6. `enrichPathInfo` - Path parameter extraction
@@ -309,7 +306,7 @@ Tests mirror source structure in `test/`:
309306
- `test/routes/` - Route matching tests
310307
- `test/support/` - Utility tests
311308
- `test/e2e/` - End-to-end tests
312-
- `test/it/` - Integration tests (DynamoDB v2 + PostgreSQL v3)
309+
- `test/it/` - Integration tests (PostgreSQL)
313310

314311
### Standard Test Pattern
315312

@@ -369,27 +366,24 @@ describe('Sites Controller', () => {
369366

370367
**Location**: `test/it/` — see [test/it/README.md](test/it/README.md) for full documentation.
371368

372-
Integration tests validate the full API request lifecycle against real database backends — no mocks. Every test runs identically against DynamoDB (v2) and PostgreSQL (v3) to ensure migration parity.
369+
Integration tests validate the full API request lifecycle against a real PostgreSQL database - no mocks.
373370

374-
**Architecture**: Shared test factories in `test/it/shared/tests/` are wired to backend-specific harnesses:
371+
**Architecture**: Shared test factories in `test/it/shared/tests/` are wired to the PostgreSQL harness:
375372

376373
```
377-
shared/tests/sites.js → dynamo/sites.test.js (uses DynamoDB Local + v2 data access)
378-
→ postgres/sites.test.js (uses Docker PostgreSQL + PostgREST)
374+
shared/tests/sites.js → postgres/sites.test.js (uses Docker PostgreSQL + PostgREST)
379375
```
380376

381377
**Key concepts**:
382378
- **Seed IDs**: All test data uses canonical UUIDs from `shared/seed-ids.js`
383379
- **Three auth personas**: `admin` (full access), `user` (ORG_1 only), `trialUser` (trial endpoints)
384380
- **Data reset**: Each `describe` block calls `before(() => resetData())` to ensure isolation
385-
- **Backend-specific options**: Use `options` parameter for v3-only features (e.g., `{ skipAsyncJobTests: true }` for DynamoDB)
386-
- **Seed data format**: DynamoDB uses camelCase, PostgreSQL uses snake_case
387-
- **v3-only entities**: `AsyncJob` only exists in PostgreSQL — DynamoDB tests skip these
381+
- **Seed data format**: snake_case in `postgres/seed-data/`
388382

389383
### Test Requirements
390384

391385
- **Behavior changes must include unit tests** - mark as Critical if missing
392-
- **New or modified endpoints must include integration tests** in `test/it/` — add shared test logic in `shared/tests/`, seed data in both `dynamo/seed-data/` and `postgres/seed-data/`, and wiring files in both backend directories
386+
- **New or modified endpoints must include integration tests** in `test/it/` — add shared test logic in `shared/tests/`, seed data in `postgres/seed-data/`, and a wiring file in `postgres/`
393387
- Mock external dependencies (databases, HTTP calls, queues) in unit tests
394388
- Test access control paths (authorized, forbidden, admin-only)
395389
- Test DTO transformations
@@ -500,10 +494,10 @@ return internalServerError('Internal error occurred');
500494
9. Write unit tests in `test/controllers/`
501495
10. Write integration tests in `test/it/`:
502496
- Add seed IDs to `test/it/shared/seed-ids.js`
503-
- Add seed data to both `dynamo/seed-data/` (camelCase) and `postgres/seed-data/` (snake_case)
504-
- Register seeds in both `dynamo/seed.js` and `postgres/seed.js`
497+
- Add seed data to `postgres/seed-data/` (snake_case)
498+
- Register seeds in `postgres/seed.js`
505499
- Write shared test factory in `test/it/shared/tests/`
506-
- Create wiring files in both `dynamo/` and `postgres/`
500+
- Create wiring file in `postgres/`
507501
11. Run `npm run docs:build` to generate documentation
508502
12. Run `npm test` to verify unit tests pass
509503
13. Run IT suites to verify integration tests pass (see Integration Tests commands above)

test/it/dynamo/.mocharc.dynamo.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/it/dynamo/audit-urls.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/it/dynamo/audits.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/it/dynamo/consumers.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/it/dynamo/entitlements.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/it/dynamo/experiments.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/it/dynamo/fixes.test.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

test/it/dynamo/harness.js

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)