Skip to content

Suggest testAndDevelopmentOnly configuration when using Docker Compose support in tests #40171

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
scottfrederick opened this issue Apr 4, 2024 · 6 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@scottfrederick
Copy link
Contributor

The documentation for Docker Compose support includes this note:

By default, Spring Boot’s Docker Compose support is disabled when running tests. To enable it, set spring.docker.compose.skip.in-tests to false.

We should also suggest that Gradle users change their build configuration from developmentOnly("org.springframework.boot:spring-boot-docker-compose") to testAndDevelopmentOnly("org.springframework.boot:spring-boot-docker-compose") when using Docker Compose for tests.

@scottfrederick scottfrederick added the type: documentation A documentation update label Apr 4, 2024
@scottfrederick scottfrederick added this to the 3.2.x milestone Apr 4, 2024
@doxxx93
Copy link

doxxx93 commented Apr 5, 2024

Also, I think that it would be better if there were additional comment.
for example

By default, Spring Boot’s Docker Compose support is disabled when running tests. To enable it, set spring.docker.compose.skip.in-tests to false and add testImplementation dependency to your build.gradle file.

@fatso83
Copy link

fatso83 commented Apr 8, 2024

@doxxx93 The testAndDevelopment bit is really what is missing here IMHO, so should not forget about that.

@YangSiJun528
Copy link
Contributor

The testAndDevelopmentOnly configuration is a new feature introduced in Spring Boot 3.2, so it's not available in Spring Boot 3.1.

For users of Spring Boot 3.1, the documentation should suggest using the developmentOnly configuration along with the testImplementation dependency to enable the Docker Compose support when running tests.

@fatso83
Copy link

fatso83 commented Apr 9, 2024

@YangSiJun528 Is it possible to use both configurations simultaneously? I thought it would have to be one or the other? You just duplicate the line like this or what? As in

dependencies {
  developmentOnly("org.springframework.boot:spring-boot-docker-compose")
  testImplementation("org.springframework.boot:spring-boot-docker-compose")
}

? I think this should be quite explicit, in that case, not ever having seen that.

@YangSiJun528
Copy link
Contributor

@fatso83, Yes, can use them simultaneously. I was actually using developmentOnly and testImplementation together before I discovered this issue.

However, if that seems unconventional there might be other viable configuration options as well.
The key point I was trying to make is that for Spring Boot 3.1, testAndDevelopmentOnly is not an option, so an alternative approach is necessary.

@doxxx93
Copy link

doxxx93 commented Apr 9, 2024

Yeah I did so. It works well in 3.2 too.

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

No branches or pull requests

4 participants