Skip to content

Commit fd64d0d

Browse files
committed
Apply suggestions
1 parent 3e6fa91 commit fd64d0d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/modules/redis/src/redis-container.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe("RedisContainer", { timeout: 240_000 }, () => {
122122

123123
it("should start redis with custom command", async () => {
124124
const container = new RedisContainer(IMAGE).withCommand(["redis-server", "--loglevel", "verbose"]);
125-
const startedContainer = await container.start();
125+
await using startedContainer = await container.start();
126126

127127
// @ts-expect-error - accessing private property for testing
128128
expect(container.createOpts.Cmd).toEqual(["redis-server", "--loglevel", "verbose"]);
@@ -138,7 +138,7 @@ describe("RedisContainer", { timeout: 240_000 }, () => {
138138

139139
it("should start redis-stack with custom env", async () => {
140140
const container = new RedisContainer(REDISSTACK_IMAGE).withEnvironment({ REDIS_ARGS: "--loglevel verbose" });
141-
const startedContainer = await container.start();
141+
await using startedContainer = await container.start();
142142

143143
// @ts-expect-error - accessing private property for testing
144144
expect(container.createOpts.Env).toEqual(["REDIS_ARGS=--loglevel verbose"]);
@@ -158,7 +158,7 @@ describe("RedisContainer", { timeout: 240_000 }, () => {
158158
const container = new RedisContainer(IMAGE)
159159
.withCommand(["redis-server", "--loglevel", "verbose"])
160160
.withPersistence(sourcePath);
161-
const startedContainer = await container.start();
161+
await using startedContainer = await container.start();
162162

163163
// @ts-expect-error - accessing private property for testing
164164
expect(container.createOpts.Cmd).toEqual([
@@ -185,7 +185,7 @@ describe("RedisContainer", { timeout: 240_000 }, () => {
185185
const container = new RedisContainer(REDISSTACK_IMAGE)
186186
.withEnvironment({ REDIS_ARGS: "--loglevel verbose" })
187187
.withPersistence(sourcePath);
188-
const startedContainer = await container.start();
188+
await using startedContainer = await container.start();
189189

190190
// @ts-expect-error - accessing private property for testing
191191
expect(container.createOpts.Env).toEqual(["REDIS_ARGS=--loglevel verbose --save 1 1 --appendonly yes"]);

packages/modules/redis/src/redis-container.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ export class RedisContainer extends GenericContainer {
4444
...(this.persistenceVolume ? ["--save 1 1 ", "--appendonly yes"] : []),
4545
];
4646
if (this.imageName.image.includes("redis-stack")) {
47-
const existingRedisArgs =
48-
(this.createOpts.Env || []).find((e) => e.startsWith("REDIS_ARGS="))?.split("=", 2)[1] || "";
47+
const existingRedisArgs = this.environment["REDIS_ARGS"] ?? "";
4948

5049
// merge with filter to remove empty items
5150
const mergedRedisArgs = [existingRedisArgs, ...redisArgs].filter(Boolean).join(" ");

0 commit comments

Comments
 (0)