mirror of
https://github.com/google/nomulus.git
synced 2025-07-14 15:05:11 +02:00
Add a Test workaround for certain Linux distro (#552)
On Arch Linux, DumpGoldenSchemaCommandTest failed due to the follow error: java.lang.RuntimeException: Container.ExecResult(exitCode=1, stdout=, stderr=pg_dump: [archiver] could not open output file "/tmp/pg_dump.out": Is a directory) However I cannot figure out why this permission error happens, as the docker command is executed as root. Saving the pg_dump output to a temporary file and copy it over the mapped file works, so I don't know...
This commit is contained in:
parent
69b8f00b4b
commit
4dfe7f34dc
1 changed files with 9 additions and 1 deletions
|
@ -36,6 +36,9 @@ public class DumpGoldenSchemaCommand extends PostgresqlCommand {
|
||||||
// The mount point in the container.
|
// The mount point in the container.
|
||||||
private static final String CONTAINER_MOUNT_POINT = "/tmp/pg_dump.out";
|
private static final String CONTAINER_MOUNT_POINT = "/tmp/pg_dump.out";
|
||||||
|
|
||||||
|
// Temporary workaround to fix permission issues on certain Linux distro (e. g. Arch Linux).
|
||||||
|
private static final String CONTAINER_MOUNT_POINT_TMP = "/tmp/pg_dump.tmp";
|
||||||
|
|
||||||
@Parameter(
|
@Parameter(
|
||||||
names = {"--output", "-o"},
|
names = {"--output", "-o"},
|
||||||
description = "Output file",
|
description = "Output file",
|
||||||
|
@ -61,6 +64,11 @@ public class DumpGoldenSchemaCommand extends PostgresqlCommand {
|
||||||
if (result.getExitCode() != 0) {
|
if (result.getExitCode() != 0) {
|
||||||
throw new RuntimeException(result.toString());
|
throw new RuntimeException(result.toString());
|
||||||
}
|
}
|
||||||
|
result = postgresContainer.execInContainer(
|
||||||
|
"cp", CONTAINER_MOUNT_POINT_TMP, CONTAINER_MOUNT_POINT);
|
||||||
|
if (result.getExitCode() != 0) {
|
||||||
|
throw new RuntimeException(result.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,7 +87,7 @@ public class DumpGoldenSchemaCommand extends PostgresqlCommand {
|
||||||
"-U",
|
"-U",
|
||||||
username,
|
username,
|
||||||
"-f",
|
"-f",
|
||||||
CONTAINER_MOUNT_POINT,
|
CONTAINER_MOUNT_POINT_TMP,
|
||||||
"--schema-only",
|
"--schema-only",
|
||||||
"--no-owner",
|
"--no-owner",
|
||||||
"--no-privileges",
|
"--no-privileges",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue