zonkyio / embedded-database-spring-test

A library for creating isolated embedded databases for Spring-powered integration tests.
Apache License 2.0
412 stars 37 forks source link

DockerClientProviderException #272

Closed mhlmhlmhlmhl closed 1 month ago

mhlmhlmhlmhl commented 7 months ago

I'm getting this error when I run an integration test in our CI pipeline (on BitBucket), but all works fine when run on my laptop:

`TenantScopedEntityTest > initializationError FAILED java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180

Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1773 Caused by: jakarta.persistence.PersistenceException at AbstractEntityManagerFactoryBean.java:421 Caused by: io.zonky.test.db.shaded.com.google.common.util.concurrent.UncheckedExecutionException at Futures.java:1546 Caused by: io.zonky.test.db.provider.ProviderException at DockerPostgresDatabaseProvider.java:117 Caused by: java.lang.IllegalStateException at DockerClientProviderStrategy.java:277`

Following various suggestions, I have:

I am using Gradle 8.5 with jvm-test-suites and Java 17. My integration test dependencies are:

testIntegration(JvmTestSuite) { testType = TestSuiteType.INTEGRATION_TEST sources { java { srcDirs = ['src/testIntegration/java'] } } dependencies { implementation project() implementation "com.cayuse:cayuse-common:${cayuseCommonVersion}" implementation "io.zonky.test:embedded-database-spring-test:${zonkyEmbeddedDatabaseVersion}" implementation "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}" implementation "org.postgresql:postgresql:${postgresSqlVersion}" implementation "net.java.dev.jna:jna:${jnaVersion}" } targets { all { testTask.configure { shouldRunAfter(test) } } } } The relevant portion of the gradle.properties file is: cayuseCommonVersion=3.0.0 jnaVersion=5.14.0 postgresSqlVersion=42.7.2 springBootVersion=3.2.2 zonkyEmbeddedDatabaseVersion=2.5.0

My laptop (where the integration test works) is a Mac M3 Pro running Sonoma 14.1.2. The BitBucket pipeline (where the above error happens) is running on some AWS server.

tomix26 commented 4 months ago

Hi @mhlmhlmhlmhl, sorry for the late reply. I would expect there to be more clues in the log about the cause of the error. DockerClientProviderException usually occurs when docker daemon is not running or is misconfigured. I need a longer or ideally full log file for further investigaion.

webcane commented 2 months ago

@tomix26 I had similar logs with cause

Caused by: java.lang.IllegalStateException: Process [/tmp/embedded-pg/PG-9792fffe99d0c596fbafe7369527c255/bin/initdb, -A, trust, -U, postgres, -D, /tmp/epg18110462070077864717, -E, UTF-8] failed
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:633)
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:250)
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:157)
    at io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:584)
    at io.zonky.test.db.provider.postgres.ZonkyPostgresDatabaseProvider$DatabaseInstance.<init>(ZonkyPostgresDatabaseProvider.java:139)
    at io.zonky.test.db.provider.postgres.ZonkyPostgresDatabaseProvider$DatabaseInstance.<init>(ZonkyPostgresDatabaseProvider.java:130)
    at io.zonky.test.db.provider.postgres.ZonkyPostgresDatabaseProvider$1.load(ZonkyPostgresDatabaseProvider.java:74)
    at io.zonky.test.db.provider.postgres.ZonkyPostgresDatabaseProvider$1.load(ZonkyPostgresDatabaseProvider.java:72)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2273)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2156)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2046)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache.get(LocalCache.java:3943)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3967)
    at io.zonky.test.db.shaded.com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4952)
    at io.zonky.test.db.provider.postgres.ZonkyPostgresDatabaseProvider.createDatabase(ZonkyPostgresDatabaseProvider.java:106)
    ... 14 more
tomix26 commented 1 month ago

@webcane You're using the Zonky provider, this issue is about the Docker provider. I really don't think there's any relation here.

tomix26 commented 1 month ago

@mhlmhlmhlmhl Closing the issue. Feel free to reopen it if the problem persists.