Start a group of containers with dependencies and shared cleanup
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 42/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- docker, node.js, typescript
调研方向
Read the existing GenericContainer and Network implementations under packages/testcontainers/src, then inspect how container startup and cleanup are handled. Design the group API from the issue’s sketch, including dependency ordering, parallel starts, shared network aliases, and stopping containers if a start fails; done means the group can start and dispose of a set of containers as described.
由索引模型根据 Issue 内容生成。
描述
What happens
A test that needs several containers wires them up by hand:
const network = await new Network().start();
const db = await new PostgreSqlContainer(dbImage).withNetwork(network).withNetworkAliases("db").start();
const app = await new GenericContainer(appImage)
.withNetwork(network)
.withEnvironment({ DATABASE_URL: "postgres://test:test@db:5432/test" })
.withExposedPorts(8080)
.start();
// ...
await app.stop();
await db.stop();
await network.stop();
- Start order is whatever order the
awaits are written in. Independent containers start one after another unless the test adds its ownPromise.all. - With
Promise.all, if onestart()rejects the others keep running until Ryuk removes them at process exit. - Cleanup is one call per container, in the right order.
Expected
A way to declare a set of containers, their dependencies and a shared network, start them as a unit and dispose of them as a unit:
await using group = await new ContainerGroup()
.with("db", new PostgreSqlContainer(dbImage))
.with("app", new GenericContainer(appImage).withExposedPorts(8080), { dependsOn: ["db"] })
.start();
const app = group.get("app");
- Containers without a dependency between them start in parallel.
- Each name becomes a network alias on a network the group owns.
- If any container fails to start, the ones already started are stopped.
Where
New code in packages/testcontainers/src, built on GenericContainer and Network.
Notes
- Java has
dependsOn(Startable...)on containers andStartables.deepStart(...)for parallel start. DockerComposeEnvironmentcovers this when the setup lives in a compose file. This is for setups defined in code, including module containers.- The API shape above is a sketch.
Dependencies
- Nothing blocks this. It can start now.
- Coordinate with #1536: a group puts its containers on a network with aliases.
- Coordinate with #1520: a group starts builders it was handed, so
start()must not change them.
- 主要语言
- TypeScript
- 星标
- 2.6k
- 派生
- 278
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 60
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testcontainers/testcontainers-node 的其他 Issue
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 74/100
testcontainers/testcontainers-node#1539 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 82/100
testcontainers/testcontainers-node#1533 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 77/100
testcontainers/testcontainers-node#1531 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 76/100
testcontainers/testcontainers-node#1529 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-node#1528 ·
维护者通常 1 天内回复
查看 testcontainers/testcontainers-node 的全部 Issue
相似的 Issue
-
area: server priority: P3 type: bug
难度 2/5 1-3 小时 新手友好度 83/100
appandflow/stim#4538 ·
维护者通常 1 天内回复
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startup可能已有人在做 @AlessandroSpallina 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
headroomlabs-ai/headroom#4513 ·
维护者通常 1 天内回复
-
bug extension extension: obsidian platform: Windows
难度 2/5 1-3 小时 新手友好度 68/100
raycast/extensions#32838 · 1 条评论 ·
维护者通常 1 天内回复
-
copy design-review mac P3
难度 2/5 1-3 小时 新手友好度 88/100
tosunlab/hisarapp-core#510 ·
-
bug priority-medium to-agent
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复