testcontainers / testcontainers/testcontainers-java
Add getMappedPort(Integer originalPort, InternetProtocol protocol)
未关闭
适合新手
还没有人认领这个 Issue。
good first issue
resolution/acknowledged
type/feature
- 主要语言
- Java
- 星标
- 8.7k
- 派生
- 1.9k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 9
描述
It will just look so much nicer in my test than
genericContainer.getContainerInfo().getNetworkSettings().getPorts().getBindings().get(new ExposedPort(originalPort, protocol))[0].getHostPortSpec()
I think it has something to do with the law of demeter.
But in all fairness root cause is https://github.com/moby/moby/issues/4635
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 GenericContainer API 中与 getContainerInfo()、NetworkSettings、bindings 和 ExposedPort 相关的部分。添加所请求的 getMappedPort(Integer originalPort, InternetProtocol protocol) 入口点,使调用方无需浏览嵌套的网络对象即可获取映射后的主机端口,然后使用相关的容器网络测试验证行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- docker, java
- 领域
- testing
- Issue 类型
- 功能
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 74/100