fix(ci): backend test suite 25-min timeout — management port TIME_WAIT regression from #576 #593
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Backend tests suddenly jumped from ~5 min to ~25 min after PR #576 added
management.server.port: 8081(fixed port) toapplication.yaml.Root cause
Four test classes use
@DirtiesContext(AFTER_EACH_TEST_METHOD):PersonServiceIntegrationTest(4 methods)DocumentSearchPagedIntegrationTest(5 methods)AuditServiceIntegrationTest(2 methods)GeschichteServiceIntegrationTest(3 methods)That is 14 context-restarts + 8 initial
@SpringBootTeststartups = ~22 management server bind/release cycles on port 8081.The OS keeps the port in
TIME_WAITfor ~45–60 s after each release. The next context startup blocks until the OS releases the port. With 22 cycles: ~17 min of pure socket-wait overhead.Before #576 the management port was random (Spring default), so each restart picked a free port and there were no conflicts.
The Maven surefire timeout (
forkedProcessTimeoutInSeconds=600) fires at 10 min even though all 1601 tests pass.Fix
Add
management.server.port: 0tobackend/src/test/resources/application-test.yaml.0means "let the OS pick a random free port" — each Spring context gets its own port, so noTIME_WAITconflicts, and the suite returns to ~5 min.Acceptance criteria
./mvnw testcompletes in under 10 minutes on the NAS runnermanagement.server.port: 0is set inapplication-test.yaml