Skip to content

fix(tests): raise the GreenMail startup timeout to 120s#6229

Merged
delchev merged 2 commits into
masterfrom
fix/greenmail-startup-timeout
Jul 10, 2026
Merged

fix(tests): raise the GreenMail startup timeout to 120s#6229
delchev merged 2 commits into
masterfrom
fix/greenmail-startup-timeout

Conversation

@delchev

@delchev delchev commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The integration-tests-h2 leg of run 29081191825 failed only in CsvimIdentityRestartIT - and not in its logic: the Spring context load failed because GreenMail missed its 30s startup window on a loaded runner (Could not start mail server smtp:localhost:36481). The test boots a fresh application context (restart semantics), so it pays a cold GreenMail start on a new random port, 90 minutes into the leg. The PostgreSQL leg ran the same test green - the failure is runner load, not H2.

Raising the startup timeout to 120s; it is an await, so healthy startups are unaffected.

🤖 Generated with Claude Code

CsvimIdentityRestartIT failed its ApplicationContext load on the integration-tests-h2 leg
(run 29081191825): GreenMail missed its 30s startup window on a loaded runner - the test
boots a fresh context (restart semantics), so it pays a cold GreenMail start on a new random
port. Not DB-related; the same test passed on the PostgreSQL leg. The timeout is an await,
so a healthy start is unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@delchev delchev force-pushed the fix/greenmail-startup-timeout branch from 7070535 to d4be392 Compare July 10, 2026 11:50
…eout was never the problem

The CI failure on this PR proved the diagnosis wrong: even with 120s
GreenMail still could not start. The startup timeout is only consumed
when the BIND failed - and waiting longer on a port someone else holds
can never succeed. The real defect: the port was probed once per JVM at
class-init (static field), while the IT suite boots many Spring
contexts in that JVM, each starting a fresh GreenMail on that SAME
port - one lingering socket from the previous context (or any service
grabbing the number in between) and every subsequent bind is dead on
arrival, however long the timeout.

provideGreenMailServer now probes a fresh random port immediately
before each bind, retrying up to 5 times, and publishes the ACTUAL
bound port into DirigibleConfig (the mail service reads it at send
time, long after the context boots, so the static pre-configuration
no longer needs to guess it). Timeout back to a moderate 20s - a
healthy bind confirms in milliseconds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@delchev

delchev commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

The smoke-tests failure on this run disproved the timeout diagnosis: GreenMail failed to start even with 120s (Could not start mail server smtp:localhost:42861, try to set server startup timeout > 120000). The startup timeout is only consumed when the bind failed — waiting longer on a taken port can never succeed.

The real defect: MAIL_PORT was probed once per JVM at class-init, but the IT suite boots many Spring contexts in that JVM and each starts a fresh GreenMail on the same port — a lingering socket from the previous context (or any other service grabbing the number in between) kills every subsequent bind.

Pushed the structural fix to this branch: fresh random port probed immediately before each bind, up to 5 attempts, actual bound port published into DirigibleConfig (read at send time), timeout back to a moderate 20s.

@delchev delchev merged commit 086d622 into master Jul 10, 2026
10 checks passed
@delchev delchev deleted the fix/greenmail-startup-timeout branch July 10, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant