[MGNLCE-162] Integration tests fail locally Created: 20/Mar/19  Updated: 27/Mar/19  Resolved: 26/Mar/19

Status: Closed
Project: Community Edition
Component/s: bundle, integration tests
Affects Version/s: 6.0
Fix Version/s: 5.5.14, 5.6.10, 5.7.3, 6.1

Type: Bug Priority: Neutral
Reporter: Federico Grilli Assignee: Federico Grilli
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: 0d
Time Spent: 0.25d
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Sprint: Foundation 6, Foundation 7
Story Points: 2

 Description   

Running integration tests locally e.g. mvn clean verify fails with

java.lang.ExceptionInInitializerError
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
Caused by: org.testcontainers.containers.ContainerLaunchException:  
Timed out waiting for log output matching '^.*Catalina\.start Server startup in [0-9]+ ms
$'

I dug the integration test setup code for containers and saw the above regex is found at
info.magnolia.integrationtests.docker.IntegrationTestEnvironment#launchApplicationServer) where org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy is used.

According to logs at magnolia-integration-tests/tests/target/integration-tests.log Magnolia actually starts up after ~220K ms (default timeout is 7 minutes) and this is the last line

INFO  [amd64/tomcat:9.0-jre8] 19.03.2019 18:40:15 -- STDERR: 19-Mar-2019 17:36:58.817 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [221,447] milliseconds 

That line actually won’t be matched by the regex, however fixing the expression doesn't seem to solve the issue. Apparently integration-tests.log is not what is used by the test container to check for when Magnolia is ready.

Asked on Slack if someone else was experiencing the same and dai.ha suggested he fixed it locally by using org.testcontainers.containers.wait.strategy.HttpWaitStrategy which indeed does the trick.


Generated at Mon Feb 12 00:06:52 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.