From 5e3276d3df90c4d9b7c8d42c16c058a8d2348809 Mon Sep 17 00:00:00 2001 From: Christie Wilson Date: Thu, 12 Sep 2019 16:49:55 -0400 Subject: [PATCH] =?UTF-8?q?Update=20fan=20in=20/=20fan=20out=20test=20(no?= =?UTF-8?q?=20automatic=20copy)=20=F0=9F=93=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we don't automatically copy the content of an input to an output (when the same resource is used as both an input and an output), this means that: - Our fan-in / fan-out test will need to explicitly write to the output path, instead of writing to the input path and assuming it would get copied over (the very behaviour we're changing in #1188) - Data previously written to an output that is used as an input, and then an output later on, will be lost unless explicitly copied. In the update to the examples this was handled by symlinking the input to the output, I decided to instead update the test to no longer expect to see a file that was written by the first task in the graph and to not copy it explicitly. Note that there is actually a race between the two tasks fanning out - if the were writing the same file we would not be able to reliably predict which would win. Part of fixing #1188 --- test/pipelinerun_test.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/pipelinerun_test.go b/test/pipelinerun_test.go index b453d82eaa0..4174a0dab4f 100644 --- a/test/pipelinerun_test.go +++ b/test/pipelinerun_test.go @@ -251,12 +251,12 @@ func getFanInFanOutTasks(namespace string) []*v1alpha1.Task { )), tb.TaskOutputs(outWorkspaceResource), tb.Step("write-data-task-0-step-0", "ubuntu", tb.StepCommand("/bin/bash"), - tb.StepArgs("-c", "echo stuff > $(inputs.resources.workspace.path)/stuff"), + tb.StepArgs("-c", "echo stuff > $(outputs.resources.workspace.path)/stuff"), ), tb.Step("write-data-task-0-step-1", "ubuntu", tb.StepCommand("/bin/bash"), // TODO(#1170): This test is using a mix of ${} and $() syntax to make sure both work. // In the next release we will remove support for $() entirely. - tb.StepArgs("-c", "echo other > ${inputs.resources.workspace.path}/other"), + tb.StepArgs("-c", "echo other > ${outputs.resources.workspace.path}/other"), ), )), tb.Task("check-create-files-exists", namespace, tb.TaskSpec( @@ -268,7 +268,7 @@ func getFanInFanOutTasks(namespace string) []*v1alpha1.Task { tb.StepArgs("-c", "[[ stuff == $(cat ${inputs.resources.workspace.path}/stuff) ]]"), ), tb.Step("write-data-task-1", "ubuntu", tb.StepCommand("/bin/bash"), - tb.StepArgs("-c", "echo something > $(inputs.resources.workspace.path)/something"), + tb.StepArgs("-c", "echo something > $(outputs.resources.workspace.path)/something"), ), )), tb.Task("check-create-files-exists-2", namespace, tb.TaskSpec( @@ -278,7 +278,7 @@ func getFanInFanOutTasks(namespace string) []*v1alpha1.Task { tb.StepArgs("-c", "[[ other == $(cat $(inputs.resources.workspace.path)/other) ]]"), ), tb.Step("write-data-task-1", "ubuntu", tb.StepCommand("/bin/bash"), - tb.StepArgs("-c", "echo else > $(inputs.resources.workspace.path)/else"), + tb.StepArgs("-c", "echo else > $(outputs.resources.workspace.path)/else"), ), )), tb.Task("read-files", namespace, tb.TaskSpec( @@ -286,12 +286,9 @@ func getFanInFanOutTasks(namespace string) []*v1alpha1.Task { tb.ResourceTargetPath("readingspace"), )), tb.Step("read-from-task-0", "ubuntu", tb.StepCommand("/bin/bash"), - tb.StepArgs("-c", "[[ stuff == $(cat $(inputs.resources.workspace.path)/stuff) ]]"), - ), - tb.Step("read-from-task-1", "ubuntu", tb.StepCommand("/bin/bash"), tb.StepArgs("-c", "[[ something == $(cat $(inputs.resources.workspace.path)/something) ]]"), ), - tb.Step("read-from-task-2", "ubuntu", tb.StepCommand("/bin/bash"), + tb.Step("read-from-task-1", "ubuntu", tb.StepCommand("/bin/bash"), // TODO(#1170): This test is using a mix of ${} and $() syntax to make sure both work. // In the next release we will remove support for $() entirely. tb.StepArgs("-c", "[[ else == $(cat ${inputs.resources.workspace.path}/else) ]]"),