Skip to content

Commit 48cc58e

Browse files
eddumelendezfokion
authored andcommitted
Fix log order after checking containerised compose exit code (testcontainers#8984)
Fixes testcontainers#7963
1 parent 40439af commit 48cc58e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/main/java/org/testcontainers/containers/ContainerisedDockerCompose.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,16 @@ public ContainerisedDockerCompose(
8383
public void invoke() {
8484
super.start();
8585

86-
this.followOutput(new Slf4jLogConsumer(logger()));
86+
followOutput(new Slf4jLogConsumer(logger()));
8787

8888
// wait for the compose container to stop, which should only happen after it has spawned all the service containers
89-
logger()
90-
.info("Docker Compose container is running for command: {}", Joiner.on(" ").join(this.getCommandParts()));
91-
while (this.isRunning()) {
89+
logger().info("Docker Compose container is running for command: {}", Joiner.on(" ").join(getCommandParts()));
90+
while (isRunning()) {
9291
logger().trace("Compose container is still running");
9392
Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
9493
}
95-
logger().info("Docker Compose has finished running");
9694

97-
AuditLogger.doComposeLog(this.getCommandParts(), this.getEnv());
95+
AuditLogger.doComposeLog(getCommandParts(), getEnv());
9896

9997
final Integer exitCode = getDockerClient()
10098
.inspectContainerCmd(getContainerId())
@@ -107,9 +105,11 @@ public void invoke() {
107105
"Containerised Docker Compose exited abnormally with code " +
108106
exitCode +
109107
" whilst running command: " +
110-
StringUtils.join(this.getCommandParts(), ' ')
108+
StringUtils.join(getCommandParts(), ' ')
111109
);
112110
}
111+
112+
logger().info("Docker Compose has finished running");
113113
}
114114

115115
private String convertToUnixFilesystemPath(String path) {

0 commit comments

Comments
 (0)