Skip to content

Integration Tests and E2E Testing #23

@Villarley

Description

@Villarley

Integration Tests and E2E Testing

📝 Description

Create a complete suite of integration tests and end-to-end tests that validate the functioning of the aggregator as a whole. These tests should simulate real data from the ingestor, verify the complete pipeline, and validate the results stored in Redis.

Context: Unit tests validate individual components, but we need tests that validate that the complete system works correctly by integrating all the pieces.

Tech Stack:

  • Jest for test runner
  • @nestjs/testing for NestJS testing
  • Testcontainers or Docker Compose for test Redis
  • Mocks for the ingestor
  • TypeScript with strict types

✅ Requirements

  • Create integration test suite for the complete pipeline
  • Implement ingestor mocks that emit test data
  • Use Testcontainers or Docker Compose to start test Redis
  • Create tests that validate the complete aggregation flow
  • Validate that data is correctly stored in Redis
  • Create tests for error scenarios (ingestor down, Redis down)
  • Implement basic load tests (throughput)
  • Create fixtures with realistic test data
  • Configure CI to automatically run integration tests

🎯 Acceptance Criteria

  • An integration test suite exists that can be run with npm run test:integration
  • Tests automatically start Redis using Testcontainers or Docker
  • The ingestor is mocked to provide controlled test data
  • Tests validate the complete pipeline from reception to storage
  • It's verified that aggregated prices are mathematically correct
  • Tests exist for error handling (services down, invalid data)
  • Tests run automatically in CI
  • Total code coverage (unit + integration) is >80%
  • How to run the tests is documented in the README

📁 Expected files to change/structure

  • apps/aggregator/test/ - Integration test directory
    • integration/
      • aggregator-pipeline.integration.spec.ts
      • error-handling.integration.spec.ts
    • e2e/
      • aggregator.e2e.spec.ts
    • fixtures/
      • price-data.fixtures.ts
    • mocks/
      • ingestor.mock.ts
    • setup/
      • test-setup.ts
  • apps/aggregator/jest.integration.config.js - Config for integration tests
  • apps/aggregator/docker-compose.test.yml - Redis for testing
  • apps/aggregator/package.json - Add test scripts and dependencies
  • .github/workflows/ci.yml - Add integration tests to CI
  • apps/aggregator/README.md - Document testing strategy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions