New Container: TestContainer for Valkey
What is the new container you'd like to have?
I’d like to add Valkey, the open-source fork of Redis, as a dedicated Testcontainers module.
- Docker container: valkey/valkey:latest
- Valkey website: https://valkey.io/
- Documentation: https://valkey.io/docs/
Why not just use a generic container for this?
- Valkey adoption is growing as an alternative to Redis to avoid licensing constraints, so reliable test coverage with real Valkey instances is important.
- Valkey‑Search enables advanced features like vector search and hybrid queries with tags/filters—common in GenAI workloads. Having a container with correct modules ensures realistic integration tests.
- Valkey GLIDE provides multi-language clients (Python/Java/Node/Go) with async support and best practices; a ValkeyContainer would align with this ecosystem for integration testing.
- Parity with existing Testcontainers DB modules: Similar to RedisContainer, a dedicated ValkeyContainer simplifies setup (config, wait strategy, connection helpers) beyond what a generic container can offer.
I’ll start working on this issue and plan to submit a PR soon.
aren't they drop in compatible? or is that no longer the case, like different log messages? another reason i initially dont want to accept is that redis went back to agpl (although it seems very confusing so i can see that being a weak driver of adoption for valkey still)
glide also supports redis, the search module is interesting and would be the only reason i dont have a response for, if in fact a separate module is needed (e.g. to listen for different log messages)
You’re right—Valkey is largely drop-in compatible with Redis for core commands, and GLIDE supports both. For most basic use cases, a generic container or even RedisContainer works fine.
The main reasons for proposing a dedicated module are:
- Valkey-Search (vector search, hybrid queries) is unique to Valkey and increasingly used in GenAI workloads. Tests that rely on these features need a container with the module preloaded.
- Parity and simplicity: Similar to RedisContainer, a ValkeyContainer provides API for developers adopting Valkey without manual tweaks.
While Valkey is largely drop in compatible for older versions of Redis, the latest Valkey versions include some features that are not supported in Redis like Multi-db support for cluster configurations. Additionally, there are small differences in some commands. Also, the various modules can have significant differences especially in Valkey-Search and Valkey-JSON modules. Effective testing requires testing against the actual db you will use in production and not something that is "close".
drop in support in this context means you can change the redis container image argument and it works