only chown autobahn reports if directory exists

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-09-21 18:45:22 +10:00 committed by olivier lamy
parent eacddab552
commit 3a1f31c9eb
1 changed files with 3 additions and 2 deletions

View File

@ -41,6 +41,7 @@ public class AutobahnTests
{
private static final Logger LOG = LoggerFactory.getLogger(AutobahnTests.class);
private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
private static final String CHOWN_REPORTS_CMD = "[ -d /target/reports ] && chown -R `stat -c '%u' /target/reports` /target/reports/*";
private Path reportDir;
private Path fuzzingServer;
@ -65,7 +66,7 @@ public class AutobahnTests
{
// We need to chown the generated test results so host has permissions to delete files generated by container.
GenericContainer<?> container = new GenericContainer<>("crossbario/autobahn-testsuite:latest")
.withCommand("/bin/bash", "-c", "wstest -m fuzzingserver -s /config/fuzzingserver.json ; chown -R `stat -c '%u' /target/reports` /target/reports/*")
.withCommand("/bin/bash", "-c", "wstest -m fuzzingserver -s /config/fuzzingserver.json ; " + CHOWN_REPORTS_CMD)
.withExposedPorts(9001)
.withLogConsumer(new Slf4jLogConsumer(LOG));
container.addFileSystemBind(fuzzingServer.toString(), "/config/fuzzingserver.json", BindMode.READ_ONLY);
@ -95,7 +96,7 @@ public class AutobahnTests
// We need to chown the generated test results so host has permissions to delete files generated by container.
GenericContainer<?> container = new GenericContainer<>("crossbario/autobahn-testsuite:latest")
.withCommand("/bin/bash", "-c", "wstest -m fuzzingclient -s /config/fuzzingclient.json ; chown -R `stat -c '%u' /target/reports` /target/reports/*")
.withCommand("/bin/bash", "-c", "wstest -m fuzzingclient -s /config/fuzzingclient.json ; " + CHOWN_REPORTS_CMD)
.withLogConsumer(new Slf4jLogConsumer(LOG))
.withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofHours(1)));
container.addFileSystemBind(fuzzingClient.toString(), "/config/fuzzingclient.json", BindMode.READ_ONLY);