-
-
Notifications
You must be signed in to change notification settings - Fork 248
Fix Redis container to accept input command #1155
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @ziggornif, yes please include the redis-stack command change in this PR |
Same as redis image with input command See issue testcontainers#1150
|
Hi @cristianrgreco, I just made the modification for redis-stack as well. The REDIS_ARGS variable now contains the merge of the user's values with the default values. I kept the current solution of creating the variable via |
| ]; | ||
| if (this.imageName.image.includes("redis-stack")) { | ||
| const existingRedisArgs = | ||
| (this.createOpts.Env || []).find((e) => e.startsWith("REDIS_ARGS="))?.split("=", 2)[1] || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug here ?.split("=", 2)[1], if the value is undefined, then calling [1] will throw TypeError, would need to be ?.[1]
Also please use ?? instead of || for specifying default values.
I would use this.environment instead of this.createOps.Env to simplify this (don't need to split strings).
| // } | ||
| }); | ||
|
|
||
| it("should start redis with custom command", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The redis containers aren't stopped at the end of the tests. Let's see if we can follow the existing await using syntax to have this handled automatically for us
| const mergedRedisArgs = [existingRedisArgs, ...redisArgs].filter(Boolean).join(" "); | ||
|
|
||
| // remove existing REDIS_ARGS to avoid duplicates | ||
| this.createOpts.Env = (this.createOpts.Env || []).filter((e) => !e.startsWith("REDIS_ARGS=")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of directly mutating this.createOpts.Env, it would be better to invoke withEnvironment
Hi,
Here's a small fix to resolve the Redis container startup issue with custom commands (#1150).
I noticed a similar issue with the redis-stack image that also overrides
this.createOpts.Env.Would you prefer I include this fix in the same PR, or should I create a separate issue to track it first?