Skip to content

Fix broken Flyway starter test and add Gradle coverage#998

Merged
steve-aom-elliott merged 2 commits intomainfrom
fix/flyway-starter-test-collision
Apr 15, 2026
Merged

Fix broken Flyway starter test and add Gradle coverage#998
steve-aom-elliott merged 2 commits intomainfrom
fix/flyway-starter-test-collision

Conversation

@steve-aom-elliott
Copy link
Copy Markdown
Contributor

@steve-aom-elliott steve-aom-elliott commented Apr 14, 2026

Summary

  • The addFlywayStarterWhenDependencyPresent test mixed Maven pomXml and Gradle buildGradle sources in the same mavenProject, which doesn't work — a project is either Maven or Gradle, not both
  • Remove the buildGradle() calls from the Maven test so it tests Maven correctly
  • Add a separate addFlywayStarterWhenGradleDependencyPresent test with proper withToolingApi() setup, Spring Boot plugin, and a Java source file for the onlyIfUsing precondition

Test plan

  • addFlywayStarterWhenDependencyPresent passes for both flyway-database-postgresql and flyway-mysql (Maven)
  • addFlywayStarterWhenGradleDependencyPresent passes for both flyway-database-postgresql and flyway-mysql (Gradle)
  • Full MigrateToModularStartersTest class passes

The test had two buildGradle() calls within the same mavenProject,
both defaulting to path "build.gradle", causing a source file path
collision. The Gradle assertions were also failing because the recipe
doesn't modify build.gradle files in a Maven-only project structure.

Remove the buildGradle assertions and keep only the Maven-based test,
which correctly validates that the Flyway starter gets added.
The original test mixed Maven pomXml and Gradle buildGradle in the
same project, which doesn't work. Split the Gradle coverage into its
own test method with proper withToolingApi() setup.
@steve-aom-elliott steve-aom-elliott changed the title Fix broken addFlywayStarterWhenDependencyPresent test Fix broken Flyway starter test and add Gradle coverage Apr 15, 2026
@steve-aom-elliott steve-aom-elliott added bug Something isn't working test provided labels Apr 15, 2026
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Apr 15, 2026
@steve-aom-elliott steve-aom-elliott merged commit 2609d53 into main Apr 15, 2026
1 check passed
@steve-aom-elliott steve-aom-elliott deleted the fix/flyway-starter-test-collision branch April 15, 2026 01:03
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test provided

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant