Skip to content

Update documentation according to Testcontainers example#29937

Closed
samuelstein wants to merge 1 commit intospring-projects:mainfrom
samuelstein:patch-1
Closed

Update documentation according to Testcontainers example#29937
samuelstein wants to merge 1 commit intospring-projects:mainfrom
samuelstein:patch-1

Conversation

@samuelstein
Copy link

Update documentation according to testcontainer example. Fix #29936

Update documentation according to testcontainer example. Fix spring-projects#29936
@pivotal-cla
Copy link

@samuelstein Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@samuelstein Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 7, 2023
@sbrannen sbrannen changed the title Update documentation Update documentation according to Testcontainers example Feb 7, 2023
@sbrannen sbrannen added in: test Issues in the test module type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 7, 2023
@sbrannen sbrannen self-assigned this Feb 7, 2023
@sbrannen sbrannen modified the milestone: 6.0.5 Feb 7, 2023
@sbrannen sbrannen marked this pull request as draft February 7, 2023 12:40
@sbrannen
Copy link
Member

sbrannen commented Feb 7, 2023

The container in the example does not need to be manually started since the JUnit Jupiter extension behind the @Testcontainers annotation handles that for you. In light of that, I am closing this PR.

However, this PR did inspire me to review the examples which resulted in #29939.

Thanks,

Sam

@sbrannen sbrannen closed this Feb 7, 2023
@sbrannen sbrannen added the status: invalid An issue that we don't feel is valid label Feb 7, 2023
@samuelstein
Copy link
Author

The thing is, that if you don't start the container explicitly in the DynamicPropertySource hook it's possible that you run in an timing issue when the hook will be called earlier than the container is started by the JUnit extension and this will result in an "Mapped port can only be obtained after the container is started" error.
The start method of the container will check anyway if the container is already started.
So calling the start method explicit will only make the process more robust and has no negative consequences i would say.
What do you think?

@sbrannen
Copy link
Member

sbrannen commented Feb 9, 2023

@eddumelendez, what are your thoughts on the matter?

@eddumelendez
Copy link
Contributor

Hi, the javadoc is using Testcontainers and Container annotations. Those are part of the junit-jupiter integration and the container will start without calling start() method. So, the change doesn't apply.

@sbrannen
Copy link
Member

sbrannen commented Feb 9, 2023

Thanks for confirming that, @eddumelendez.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: test Issues in the test module status: invalid An issue that we don't feel is valid type: documentation A documentation task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update documentation according to testcontainer example

5 participants