Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: speed up router-tests #1428

Merged
merged 100 commits into from
Jan 3, 2025
Merged

Conversation

alepane21
Copy link
Contributor

@alepane21 alepane21 commented Dec 10, 2024

Motivation and Context

It is important to make the tests as fast as possible. This PR addresses parallelization issues in the test suite, improves test reliability, and optimizes resource usage. Using insights from this library to identify tests that were not running in parallel, I was able to uncover additional issues such as unnecessary locks, data races, and flaky test behavior under load.

Checklist

Key Changes

  1. Test Parallelization Analysis

  2. Shared Kafka and NATS Instances

    • All tests now share a single Kafka and NATS instance to reduce overhead.
  3. Removed Unnecessary Locks

    • Eliminated the mutex in createTestEnv by leveraging the Freeport library.
  4. Concurrent Safety Enhancements

    • Improved demo server handling of port allocation and ensured thread safety (previously affected by shared mutable state).
  5. Integration Test Job

    • Created a dedicated GitHub job for integration tests.
    • Removed Redis from other jobs
  6. Improved Parallelization

    • Reorganized tests across packages to facilitate parallel execution.
  7. Retries for Flaky Tests

Future Improvements (Separate PR)

  1. Use external Kafka and NATS services (similar to Redis).
  2. Further reduce test flakiness, especially in telemetry, Kafka, and NATS-related tests.
  3. Avoid duplicated work (the unit tests are run more than one time, as it is the image building process)

@github-actions github-actions bot removed the router label Dec 19, 2024
Copy link

github-actions bot commented Dec 19, 2024

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@alepane21 alepane21 changed the title feat: use a single kafka and nats server feat: speed up router-tests Dec 20, 2024
@alepane21 alepane21 marked this pull request as ready for review January 3, 2025 09:29
@alepane21 alepane21 merged commit 8a7d8cf into main Jan 3, 2025
19 checks passed
@alepane21 alepane21 deleted the ale/eng-5980-how-to-speed-up-router-tests branch January 3, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants