Skip to content

Configure tests using TestContainer to use the actual container IP address #21480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

olamy
Copy link
Contributor

@olamy olamy commented May 17, 2020

At the Jetty project we want to have daily/weekly of Opensource project using Jetty but with last SNAPSHOT. To be sure we are not breaking anything :)
As our CI environment is based on K8s pods, using localhost for docker images started with testcontainers doesn't work.
I just made the changes to get it working (see https://jenkins.webtide.net/job/external_oss/job/spring-boot-build-jetty-9.4.x-snapshot/) and using the testcontainer recommended usage https://www.testcontainers.org/features/networking/#getting-the-container-ip-address.

Another question I have (maybe can be in a separate issue If you prefer?).
I looked at implementing this SNAPSHOT build for spring-boot/spring-framework but with the gradle build. Unfortunately I cannot change the jetty version dynamically. I tried different way but as it's using mavenBom and not the usual gradle dependency management system (this doesn't work see script here: https://github.com/jetty-project/external-oss-builds/blob/master/init.gradle.spring-framework)
If you have any idea/trick please let me know?

Signed-off-by: olivier lamy [email protected]

…lt localhost can cause issue in some environement

Signed-off-by: olivier lamy <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 17, 2020
@@ -74,7 +74,7 @@ static void createBucket() {
void setUp() {
this.context = new AnnotationConfigApplicationContext();
this.context.register(CouchbaseAutoConfiguration.class);
TestPropertyValues.of("spring.couchbase.bootstrap-hosts=localhost",
TestPropertyValues.of("spring.couchbase.bootstrap-hosts=" + couchbase.getContainerIpAddress(),
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI Testcontainers 1.14.2 adds getHost() (returns the same value as getContainerIpAddress() but less confusing), consider using it once Spring Boot updates TC to 1.14.2

@olamy
Copy link
Contributor Author

olamy commented May 19, 2020

@wilkinsona as you are the main contributor of https://github.com/spring-gradle-plugins/dependency-management-plugin any idea regarding the question about dependencies? Do you prefer create a separate issue for that?

@wilkinsona
Copy link
Member

@olamy Hard to say right now as I'm not sure what the problem is. The link you shared above 404s for me. Private repo, perhaps?

@olamy
Copy link
Contributor Author

olamy commented May 19, 2020

@wilkinsona oh sorry it's now public.

@wilkinsona
Copy link
Member

@olamy I've opened an issue on that repository with a suggestion.

@snicoll snicoll added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels May 25, 2020
@snicoll snicoll self-assigned this May 25, 2020
@snicoll snicoll added this to the 2.3.1 milestone May 25, 2020
@snicoll snicoll changed the title configure test using TestContainer to use containerIpAddress as default localhost can cause issue in some environement Configure tests using TestContainer to use the actual container IP address May 25, 2020
@snicoll snicoll modified the milestones: 2.3.1, 2.2.8 May 25, 2020
@snicoll snicoll closed this in a657c97 May 25, 2020
@snicoll
Copy link
Member

snicoll commented May 25, 2020

Thanks for the PR Olivier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants