Hi,
I cannot get the Wait.forLogMessage to work with a custom container based on the official Neo4j image:
This repeatedly times out:
new GenericContainer("neo4j:3.4.7") // TODO Derive from Maven properties
.withExposedPorts(7687)
.withEnv("NEO4J_AUTH", "none")
.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(Neo4jClientVerificationTest.class)))
.waitingFor(forLogMessage(".*Bolt enabled on 0\\.0\\.0\\.0:7687\\.", 1));
I'm on Java 11, full example is here
I thought I was stupid and didn't get the regex right, but every other, i.e. .*config.* fails, too
Hi @michael-simons,
Does it work if you add .*\n at the end?
Something like forLogMessage(".*Bolt enabled on 0\\.0\\.0\\.0:7687\\..*\n", 1)
Lovely. That works. I'm happy that it was my fault.
I was expecting the matcher is running in single line mode (pretty much like the docker maven plugin.
@michael-simons honestly - I expect the same every time 馃槀 We should probably consider that /cc @rnorth @kiview
Yes, I can totally understand this confusion. I always set the global flag on the regex so wildcard matches line break.
Yeah, let鈥檚 change this, as it鈥檚 a bit of a nasty surprise. (I too have been caught out by it once!)
The question is how to change it; altering the current behaviour seems unpleasant. A small change to the method signature would be a breaking change, but would be quickly found and fixed. Let鈥檚 discuss options.
I would think the easiest change would be adding the DOTALL flag (see https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#DOTALL) as a default and it would possibly not really break anything.
Yep, regexes ending in \n would still match.
Most helpful comment
Hi @michael-simons,
Does it work if you add
.*\nat the end?Something like
forLogMessage(".*Bolt enabled on 0\\.0\\.0\\.0:7687\\..*\n", 1)