Skip to content

Test stuck with Springboot 4 #318

@GLTron3000

Description

@GLTron3000

My team migrated a project from Spring Boot 3 to Spring Boot 4, going from version 2.6.0 to 2.7.1.

Previously working integration test now hang indefinitely, throw no warnings (and seems to run out of memory at some point ?).

I am sorry if it isn't a issue with the zonky itself, but we cant seems to find the problem and ran out of ideas :(

The test class

@SpringBootTest(classes = MageBackendApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureEmbeddedDatabase(
        provider = AutoConfigureEmbeddedDatabase.DatabaseProvider.EMBEDDED,
        type =  AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES,
        refresh = AutoConfigureEmbeddedDatabase.RefreshMode.BEFORE_CLASS)
@ActiveProfiles({"test", "jpa-postgres", "liquibase", "swagger", "forgerock-indus"})
@AutoConfigureMockMvc
class IntegrationDemoTest {

    @Autowired
    private MockMvc mockMvc;

    @SneakyThrows
    @Test
    void testYourAPI() {
        mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/demo"))
                .andExpect(status().isOk())
                .andExpect(jsonPath("$.content", hasSize(20)))
                .andExpect(jsonPath("$.content[0].id", equalTo(1)))
                .andExpect(jsonPath("$.content[0].name", equalTo("Pen")))
                .andExpect(jsonPath(
                        "$.content[0].description", equalTo("A writing instrument used to apply ink to a surface.")))
                .andExpect(jsonPath("$.content[1].id", equalTo(2)))
                .andExpect(jsonPath("$.content[1].name", equalTo("Notebook")))
                .andExpect(jsonPath(
                        "$.content[1].description",
                        equalTo("A bound collection of pages used for writing notes or keeping records.")))
                .andReturn();
    }
}

The output

:: Spring Boot ::                (v4.0.0)

2026-01-26T12:04:29.832+01:00  INFO 52026 --- [           main] c.m.m.c.s.a.WebSecurityConfigurationTest : Starting WebSecurityConfigurationTest using Java 25.0.1 with PID 52026 ()
2026-01-26T12:04:29.841+01:00  INFO 52026 --- [           main] c.m.m.c.s.a.WebSecurityConfigurationTest : The following 4 profiles are active: "test", "jpa-postgres", "liquibase","swagger"
2026-01-26T12:04:34.557+01:00  INFO 52026 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2026-01-26T12:04:34.763+01:00  INFO 52026 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 168 ms. Found 1 JPA repository interface.
2026-01-26T12:04:35.714+01:00  INFO 52026 --- [           main] EmbeddedDatabaseContextCustomizerFactory : Replacing 'dataSource' DataSource bean with embedded version
2026-01-26T12:04:36.352+01:00  WARN 52026 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'io.zonky.test.db.config.EmbeddedDatabaseAutoConfiguration' of type [io.zonky.test.db.config.EmbeddedDatabaseAutoConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [liquibaseDatabaseExtension] is declared through a non-static factory method on that class; consider declaring it as static instead.
2026-01-26T12:04:37.458+01:00  INFO 52026 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat initialized with port 0 (http)
2026-01-26T12:04:37.532+01:00  INFO 52026 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2026-01-26T12:04:37.535+01:00  INFO 52026 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/11.0.14]
2026-01-26T12:04:37.763+01:00  INFO 52026 --- [           main] b.w.c.s.WebApplicationContextInitializer : Root WebApplicationContext: initialization completed in 7721 ms
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by io.zonky.test.db.shaded.com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:.m2/repository/io/zonky/test/embedded-database-spring-test/2.7.1/embedded-database-spring-test-2.7.1.jar)
WARNING: Please consider reporting this to the maintainers of class io.zonky.test.db.shaded.com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
2026-01-26T12:04:38.745+01:00  INFO 52026 --- [  prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres      : Detected a Linux x86_64 system
2026-01-26T12:04:38.857+01:00  INFO 52026 --- [  prefetching-1] .z.t.d.p.e.DefaultPostgresBinaryResolver : Detected distribution: 'Ubuntu'
2026-01-26T12:04:38.864+01:00  INFO 52026 --- [  prefetching-1] .z.t.d.p.e.DefaultPostgresBinaryResolver : System specific postgres binaries found: 'postgres-linux-x86_64.txz'
2026-01-26T12:04:39.104+01:00  INFO 52026 --- [  prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres      : Postgres binaries at /tmp/embedded-pg/PG-16e48326a2cbaa18f1179ea1efa0ffd0
2026-01-26T12:04:39.167+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : The files belonging to this database system will be owned by user "thomas".
2026-01-26T12:04:39.174+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : This user must also own the server process.
2026-01-26T12:04:39.175+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :
2026-01-26T12:04:39.175+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : The database cluster will be initialized with locale "en_US.UTF-8".
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : The default text search configuration will be set to "english".
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : Data page checksums are disabled.
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : fixing permissions on existing directory /tmp/epg608847135664728551 ... ok
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : creating subdirectories ... ok
2026-01-26T12:04:39.183+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : selecting dynamic shared memory implementation ... posix
2026-01-26T12:04:39.202+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : selecting default max_connections ... 100
2026-01-26T12:04:39.250+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : selecting default shared_buffers ... 128MB
2026-01-26T12:04:39.265+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : selecting default time zone ... Europe/Paris
2026-01-26T12:04:39.274+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : creating configuration files ... ok
2026-01-26T12:04:39.494+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : running bootstrap script ... ok
2026-01-26T12:04:40.638+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : performing post-bootstrap initialization ... ok
2026-01-26T12:04:41.222+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : syncing data to disk ... ok
2026-01-26T12:04:41.222+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :
2026-01-26T12:04:41.222+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      : Success. You can now start the database server using:
2026-01-26T12:04:41.226+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :
2026-01-26T12:04:41.226+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :     /tmp/embedded-pg/PG-16e48326a2cbaa18f1179ea1efa0ffd0/bin/pg_ctl -D /tmp/epg608847135664728551 -l logfile start
2026-01-26T12:04:41.226+01:00  INFO 52026 --- [itdb:pid(52098)] i.z.t.d.p.embedded.EmbeddedPostgres      :
2026-01-26T12:04:41.223+01:00  INFO 52026 --- [  prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres      : 903f4030-6031-4877-8ec2-0aa04bdb0528 initdb completed in 00:00:02.114
2026-01-26T12:04:41.249+01:00  INFO 52026 --- [  prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres      : 903f4030-6031-4877-8ec2-0aa04bdb0528 postmaster started as Process[pid=52112, exitValue="not exited"] on port 46185.  Waiting up to PT20S for server startup to finish.
2026-01-26T12:04:41.284+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      : waiting for server to start....2026-01-26 12:04:41.284 CET [52116] LOG:  starting PostgreSQL 14.20 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
2026-01-26T12:04:41.289+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      : 2026-01-26 12:04:41.289 CET [52116] LOG:  listening on IPv4 address "127.0.0.1", port 46185
2026-01-26T12:04:41.299+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      : 2026-01-26 12:04:41.299 CET [52116] LOG:  listening on Unix socket "/tmp/.s.PGSQL.46185"
2026-01-26T12:04:41.325+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      : 2026-01-26 12:04:41.323 CET [52117] LOG:  database system was shut down at 2026-01-26 12:04:40 CET
2026-01-26T12:04:41.335+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      : 2026-01-26 12:04:41.329 CET [52116] LOG:  database system is ready to accept connections
2026-01-26T12:04:41.363+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      :  done
2026-01-26T12:04:41.363+01:00  INFO 52026 --- [gres:pid(52112)] i.z.t.d.p.embedded.EmbeddedPostgres      : server started
2026-01-26T12:04:41.649+01:00  INFO 52026 --- [  prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres      : 903f4030-6031-4877-8ec2-0aa04bdb0528 postmaster startup finished in 00:00:00.409

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions