Skip to content

Commit e4c86a5

Browse files
committed
add tests
1 parent 2b28fb4 commit e4c86a5

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

pkg/formatted/workspace.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ func Workspace(ws v1beta1.WorkspaceBinding) string {
4141
secret := getWorkspaceSecret(ws.Secret)
4242
return fmt.Sprintf("Secret (%s)", secret)
4343
}
44+
if ws.CSI != nil {
45+
return fmt.Sprintf("CSI (Driver=%s)", ws.CSI.Driver)
46+
}
4447
return ""
4548
}
4649

pkg/formatted/workspace_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ func TestWorkspace(t *testing.T) {
4747
SecretName: "foobar",
4848
},
4949
},
50+
{
51+
Name: "csi",
52+
CSI: &corev1.CSIVolumeSource{
53+
Driver: "secrets-store.csi.k8s.io",
54+
},
55+
},
5056
}
5157
defaultEmptyWorkspaceStr := Workspace(workspaceSpec[0]) // EmptyDir workspace with default storage medium
5258
assert.Equal(t, defaultEmptyWorkspaceStr, "EmptyDir (emptyDir=)")
@@ -59,4 +65,7 @@ func TestWorkspace(t *testing.T) {
5965

6066
secretWorkspaceStr := Workspace(workspaceSpec[3]) // Secret Workspace
6167
assert.Equal(t, secretWorkspaceStr, "Secret (secret=foobar)")
68+
69+
csiWorkspaceStr := Workspace(workspaceSpec[4]) // CSI Workspace
70+
assert.Equal(t, csiWorkspaceStr, "CSI (Driver=secrets-store.csi.k8s.io)")
6271
}

0 commit comments

Comments
 (0)