From 9b73f61a8282cc5bfb6adc233fc5dd1a3aabe37b Mon Sep 17 00:00:00 2001 From: ericzzzzzzz <102683393+ericzzzzzzz@users.noreply.github.com> Date: Thu, 11 Jan 2024 11:58:15 -0500 Subject: [PATCH] chore: add more tests csi --- .../pipelinerun/resources/apply_test.go | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/pkg/reconciler/pipelinerun/resources/apply_test.go b/pkg/reconciler/pipelinerun/resources/apply_test.go index 682f36d835a..c14723cc6fb 100644 --- a/pkg/reconciler/pipelinerun/resources/apply_test.go +++ b/pkg/reconciler/pipelinerun/resources/apply_test.go @@ -5287,6 +5287,76 @@ func TestApplyResultsToWorkspaceBindings(t *testing.T) { }, }, }, + { + name: "csi-driver", + trResults: map[string][]v1.TaskRunResult{ + "task6": { + { + Name: "driver-name", + Type: v1.ResultsTypeString, + Value: v1.ResultValue{StringVal: "driver-value"}, + }, + }, + }, + pr: &v1.PipelineRun{ + Spec: v1.PipelineRunSpec{ + Workspaces: []v1.WorkspaceBinding{ + { + CSI: &corev1.CSIVolumeSource{ + Driver: "$(tasks.task6.results.driver-name)", + }, + }, + }, + }, + }, + expectedPr: &v1.PipelineRun{ + Spec: v1.PipelineRunSpec{ + Workspaces: []v1.WorkspaceBinding{ + { + CSI: &corev1.CSIVolumeSource{ + Driver: "driver-value", + }, + }, + }, + }, + }, + }, + { + name: "csi-NodePublishSecretRef-name", + trResults: map[string][]v1.TaskRunResult{ + "task6": { + { + Name: "ref-name", + Type: v1.ResultsTypeString, + Value: v1.ResultValue{StringVal: "ref-value"}, + }, + }, + }, + pr: &v1.PipelineRun{ + Spec: v1.PipelineRunSpec{ + Workspaces: []v1.WorkspaceBinding{ + { + CSI: &corev1.CSIVolumeSource{ + Driver: "driver", + NodePublishSecretRef: &corev1.LocalObjectReference{Name: "$(tasks.task6.results.ref-name)"}, + }, + }, + }, + }, + }, + expectedPr: &v1.PipelineRun{ + Spec: v1.PipelineRunSpec{ + Workspaces: []v1.WorkspaceBinding{ + { + CSI: &corev1.CSIVolumeSource{ + Driver: "driver", + NodePublishSecretRef: &corev1.LocalObjectReference{Name: "ref-value"}, + }, + }, + }, + }, + }, + }, { name: "pvc object-result", trResults: map[string][]v1.TaskRunResult{