Container definition API by eddumelendez · Pull Request #7714 · testcontainers/testcontainers-java (original) (raw)

@eddumelendez

Introduce ContainerDef and apply it to PortForwardingContainer
and MongoDBContainer.

@eddumelendez

@eddumelendez

@eddumelendez

@eddumelendez

@eddumelendez

@eddumelendez @bsideup

Co-authored-by: Sergei Egorov bsideup@gmail.com

@eddumelendez

@eddumelendez

@eddumelendez

@eddumelendez

We can fix #7708 by switching to this.containerDef.addExposedTcpPorts(ports); here WDYT?

bsideup

@eddumelendez

@eddumelendez

kiview

private boolean privilegedMode;
@NonNull
private List volumesFroms = new ArrayList<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we move it in a follow-up PR to avoid breaking changes?

@eddumelendez

@eddumelendez

@eddumelendez

bsideup

Comment on lines -908 to -914

Map<String, String> combinedLabels = new HashMap<>();
combinedLabels.putAll(labels);
if (createCommand.getLabels() != null) {
combinedLabels.putAll(createCommand.getLabels());
}
createCommand.withLabels(combinedLabels);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, as previously we were combining the labels

kiview

Comment on lines -908 to -914

Map<String, String> combinedLabels = new HashMap<>();
combinedLabels.putAll(labels);
if (createCommand.getLabels() != null) {
combinedLabels.putAll(createCommand.getLabels());
}
createCommand.withLabels(combinedLabels);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the order with regards to CreateContainerCmdModifier

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a change to to an undocumented internal behavior, we are fine with accepting it.

@nitesh0420

Sadly it broke our tests. 😄

@eddumelendez

Sorry, but that doesn't provide much information about the issue you are having. We have been reported about some regressions and some of them are fixed now, see this list. There is one more that should be fixed tomorrow. If you can not find yours, please feel free to open a new issue.

@illabefat

fokion pushed a commit to fokion/testcontainers-java that referenced this pull request

Jan 18, 2025

Introduce ContainerDef and apply it to PortForwardingContainer and MongoDBContainer.

ContainerDef is an internal API used by GenericContainer to decouple the state of container creation and the running state.


Co-authored-by: Sergei Egorov bsideup@gmail.com

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})