Skip to content

Commit

Permalink
Bulk Load CDK: fix workdir in tests (#51581)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao authored Jan 16, 2025
1 parent 767e820 commit 2d691b3
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ class DockerizedDestination(
// Certainly nothing in the bulk CDK's test suites is reading back
// anything in this directory.
val localRoot = Files.createTempDirectory(testDir, "output")

// This directory will contain the actual inputs to the connector (config+catalog),
// and is also mounted as a volume.
val jobRoot = Files.createDirectories(workspaceRoot.resolve("job"))
val jobDir = "job"
val jobRoot = Files.createDirectories(workspaceRoot.resolve(jobDir))

val containerDataRoot = "/data"
val containerJobRoot = "$containerDataRoot/$jobDir"

// This directory is being used for the file transfer feature.
if (useFileTransfer) {
Expand Down Expand Up @@ -109,15 +114,16 @@ class DockerizedDestination(
"--init",
"-i",
"-w",
"/data/job",
// In real syncs, platform changes the workdir to /dest for destinations.
"/dest",
"--log-driver",
"none",
"--name",
containerName,
"--network",
"host",
"-v",
String.format("%s:%s", workspaceRoot, "/data"),
String.format("%s:%s", workspaceRoot, containerDataRoot),
"-v",
String.format("%s:%s", localRoot, "/local"),
"-v",
Expand Down Expand Up @@ -147,7 +153,7 @@ class DockerizedDestination(
fileContents,
)
cmd.add("--$paramName")
cmd.add("destination_$paramName.json")
cmd.add("$containerJobRoot/destination_$paramName.json")
}
configContents?.let { addInput("config", it.toByteArray(Charsets.UTF_8)) }
catalog?.let { addInput("catalog", catalog.serializeToJsonBytes()) }
Expand Down

0 comments on commit 2d691b3

Please sign in to comment.