Skip to content

Conversation

@saswatds
Copy link
Owner

@saswatds saswatds commented Oct 16, 2025

This pull request introduces support for "testable" modules for MongoDB, OpenSearch, RabbitMQ, and Redis, enabling easy integration testing with disposable containerized services via Testcontainers. It also refactors configuration schemas for these modules to use Zod validation and exposes new entrypoints for testable variants in their respective packages. These changes improve testability, configuration safety, and developer experience.

Testable module support and containerized testing:

  • Added new testable.ts modules for MongoDB, OpenSearch, RabbitMQ, and Redis, allowing each service to be spun up in a disposable container for integration tests using Testcontainers. These modules override connection details at runtime, simplifying test setup. [1] [2] [3]
  • Updated documentation (README.md) for Redis to describe usage of TestableCortecRedis for integration testing.

Configuration schema refactoring:

  • Refactored configuration handling in MongoDB and Redis modules to use Zod schemas for validation (DBConfigSchema and RedisConfigSchema), replacing previous untyped config access. [1] [2]
  • Improved OpenSearch and RabbitMQ config types, adding support for new fields like rejectUnauthorized for OpenSearch SSL, and making config properties protected for easier extension. [1] [2] [3] [4]

Package exports and dependencies:

  • Updated package.json files for all four modules to export new testable entrypoints and added testcontainers as a dev dependency, along with necessary type dependencies. [1] [2] [3] [4] [5] [6]

Redis cluster and retry logic improvements:

  • Refactored Redis cluster initialization to handle host/port and cluster node management more robustly, and improved retry strategy logic for connection failures. [1] [2] [3] [4]

OpenSearch SSL options:

  • Added support for rejectUnauthorized in OpenSearch SSL configuration, and ensured this option is correctly passed to the client. [1] [2] [3]

Let me know if you want to see how to use any of these testable modules in your own tests!

- Introduce TestableCortecMongodb for integration testing - Update
config and typings for testable MongoDB usage - Add testcontainers as a
dev dependency - Improve Redis testable module logging - Update test
suite to use testable MongoDB and Redis - Adjust tsconfig for Node16
module resolution
Add testable OpenSearch container for integration testing
@saswatds saswatds merged commit 1eeebcc into main Oct 17, 2025
1 check passed
@saswatds saswatds deleted the testable-continer branch October 17, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants