Skip to content
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

Error in version 2.1.0 with spring-boot #143

Open
igorr77 opened this issue Dec 27, 2024 · 1 comment
Open

Error in version 2.1.0 with spring-boot #143

igorr77 opened this issue Dec 27, 2024 · 1 comment

Comments

@igorr77
Copy link

igorr77 commented Dec 27, 2024

Hi!
I want to use zonky in my spring-boot project to test working with postgree database. When using io.zonky.test.embedded-postgres version 1.x.x everything works fine, but postgree version is less than 13. If I specify io.zonky.test.embedded-postgres version 2.1.0 (2.x.x), I get an error

Caused by: io.zonky.test.db.config.MissingProviderDependencyException: You have to add the following dependency to your project: 'io.zonky.test:embedded-postgres'

Project settings:
java 17, spring-boot 3.2.3

zonky.test.database.type=postgres
zonky.test.database.provider=zonky    
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
<dependency
    <groupId>io.zonky.test</groupId>
    <artifactId>embedded-postgres</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>io.zonky.test</groupId>
    <artifactId>embedded-database-spring-test</artifactId>
    <version>2.6.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>42.7.4</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>io.zonky.test.postgres</groupId>
    <artifactId>embedded-postgres-binaries-bom</artifactId>
    <version>17.0.0</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>
@ActiveProfiles("test")
@RunWith(SpringRunner.class)
@AutoConfigureEmbeddedDatabase
@DataJpaTest
@ContextConfiguration(classes = DomainConfig.class)
class ZonkyTest {

    @Autowired
    private TaskRepository repository;

    @Test
    void test_repository() {
        var list = repository.findAll();

        assertThat(list).isNotNull();
    }
}

Does anyone know what I'm doing wrong?
thanks

@tomix26
Copy link
Collaborator

tomix26 commented Jan 18, 2025

Hi @igorr77, sorry for the delayed response.

The error message describes the problem quite accurately. You probably don't have the io.zonky.test.embedded-postgres dependency set up correctly. In version 1.x, this dependency was part of the library, but from version 2.x onward, you need to add it manually.

My guess is that you have the dependency listed in the <dependencyManagement> section of your pom.xml, but not in the <dependencies> section.

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

No branches or pull requests

2 participants