Open kevbook opened 2 months ago
Just add this line. All tests should pass
/* Make sure the redis image is a not a `redis-stack` image as `redis-stack` images have a custom entrypoint, see https://hub.docker.com/r/redis/redis-stack-server */
if (!this.imageName.image.includes("redis-stack")) {
this.withCommand([
"redis-server",
...(this.password ? [`--requirepass "${this.password}"`] : []),
...(this.persistenceVolume ? ["--save 1 1 ", "--appendonly yes"] : []),
]);
}
With redis-stack this.withCommand
will not be applicable as all custom args are passed via env vars.
Expected Behaviour
This will fail because of the
redis-server
command. https://github.com/testcontainers/testcontainers-node/blob/9f7fd4eff5e6f05440016010964a78aa80557cb1/packages/modules/redis/src/redis-container.ts#L36-L39As you can see from the docker images,
redis
usesCMD [redis-server]
butredis-stack-server
uses a custom entrypoint script. So I'm happy to open a PR, basically based on image string passed, we'll need to change howcontainer.start()
is handled (It's messy but not sure how else to solve it when you have 2 Redis images now!)