@@ -16,6 +16,8 @@ const (
1616 testSetupVenv = "setup-venv"
1717 testSSHDContainer = "sshd"
1818 testSSHFSName = "sshfs-0"
19+ testCWSidecarName = "cw-0"
20+ testSSHPubkeyName = "ssh-pubkey"
1921)
2022
2123func TestBuildPod_BasicConfig (t * testing.T ) {
@@ -1163,8 +1165,8 @@ func TestBuildPod_WithCWMounts(t *testing.T) {
11631165
11641166 // Second container should be cw sidecar
11651167 cwSidecar := pod .Spec .Containers [1 ]
1166- if cwSidecar .Name != "cw-0" {
1167- t .Errorf ("expected sidecar name 'cw-0 ', got '%s'" , cwSidecar .Name )
1168+ if cwSidecar .Name != testCWSidecarName {
1169+ t .Errorf ("expected sidecar name '%s ', got '%s'" , testCWSidecarName , cwSidecar .Name )
11681170 }
11691171}
11701172
@@ -1208,8 +1210,8 @@ func TestExpandMounts_CW(t *testing.T) {
12081210 }
12091211
12101212 sidecar := sidecars [0 ]
1211- if sidecar .Name != "cw-0" {
1212- t .Errorf ("expected name 'cw-0 ', got %q" , sidecar .Name )
1213+ if sidecar .Name != testCWSidecarName {
1214+ t .Errorf ("expected name '%s ', got %q" , testCWSidecarName , sidecar .Name )
12131215 }
12141216
12151217 if ! strings .Contains (sidecar .Image , "s3fs" ) {
@@ -1335,7 +1337,7 @@ func TestBuildPod_MountPropagation_WithFUSESidecar(t *testing.T) {
13351337 if pod .Spec .Containers [i ].Name == testMarimoContainer {
13361338 marimoContainer = & pod .Spec .Containers [i ]
13371339 }
1338- if pod .Spec .Containers [i ].Name == "cw-0" {
1340+ if pod .Spec .Containers [i ].Name == testCWSidecarName {
13391341 cwContainer = & pod .Spec .Containers [i ]
13401342 }
13411343 }
@@ -1344,7 +1346,7 @@ func TestBuildPod_MountPropagation_WithFUSESidecar(t *testing.T) {
13441346 t .Fatal ("marimo container not found" )
13451347 }
13461348 if cwContainer == nil {
1347- t .Fatal ( "cw-0 container not found" )
1349+ t .Fatalf ( "%s container not found", testCWSidecarName )
13481350 }
13491351
13501352 // Check marimo has HostToContainer propagation on PVC mount
@@ -1442,16 +1444,16 @@ func TestBuildPod_SSHFSSidecar_SecretMount(t *testing.T) {
14421444 // Check ssh-pubkey volume exists
14431445 var foundSSHPubkeyVolume bool
14441446 for _ , vol := range pod .Spec .Volumes {
1445- if vol .Name == "ssh-pubkey" {
1446- if vol .Secret == nil || vol .Secret .SecretName != "ssh-pubkey" {
1447- t .Error ( "ssh-pubkey volume should reference ssh-pubkey secret" )
1447+ if vol .Name == testSSHPubkeyName {
1448+ if vol .Secret == nil || vol .Secret .SecretName != testSSHPubkeyName {
1449+ t .Errorf ( "%s volume should reference %s secret", testSSHPubkeyName , testSSHPubkeyName )
14481450 }
14491451 foundSSHPubkeyVolume = true
14501452 break
14511453 }
14521454 }
14531455 if ! foundSSHPubkeyVolume {
1454- t .Error ("expected ssh-pubkey volume to be present for sshfs sidecar" )
1456+ t .Errorf ("expected %s volume to be present for sshfs sidecar" , testSSHPubkeyName )
14551457 }
14561458
14571459 // Find sshfs sidecar and check it has the secret mounted
@@ -1470,7 +1472,7 @@ func TestBuildPod_SSHFSSidecar_SecretMount(t *testing.T) {
14701472 // Check ssh-pubkey is mounted at /config/ssh-pubkey
14711473 var foundSSHPubkeyMount bool
14721474 for _ , vm := range sshfsSidecar .VolumeMounts {
1473- if vm .Name == "ssh-pubkey" && vm .MountPath == "/config/ssh-pubkey" && vm .ReadOnly {
1475+ if vm .Name == testSSHPubkeyName && vm .MountPath == "/config/" + testSSHPubkeyName && vm .ReadOnly {
14741476 foundSSHPubkeyMount = true
14751477 break
14761478 }
@@ -1500,8 +1502,8 @@ func TestBuildPod_NoSSHFSSidecar_NoSecretMount(t *testing.T) {
15001502
15011503 // Check ssh-pubkey volume does NOT exist
15021504 for _ , vol := range pod .Spec .Volumes {
1503- if vol .Name == "ssh-pubkey" {
1504- t .Error ( "ssh-pubkey volume should NOT be present when no sshfs sidecar" )
1505+ if vol .Name == testSSHPubkeyName {
1506+ t .Errorf ( "%s volume should NOT be present when no sshfs sidecar", testSSHPubkeyName )
15051507 }
15061508 }
15071509}
0 commit comments