@@ -321,6 +321,11 @@ func (t *gcsFuseCSIVolumesTestSuite) DefineTests(driver storageframework.TestDri
321321 tPod .SetCustomSidecarContainerImage ()
322322 tPod .SetupVolume (l .volumeResource , volumeName , mountPath , false )
323323
324+ if configPrefix == specs .EnableHostNetworkPrefix {
325+ ginkgo .By ("Turn on hostnetwork setting" )
326+ tPod .EnableHostNetwork ()
327+ }
328+
324329 ginkgo .By ("Deploying the pod" )
325330 tPod .Create (ctx )
326331 defer tPod .Cleanup (ctx )
@@ -330,15 +335,20 @@ func (t *gcsFuseCSIVolumesTestSuite) DefineTests(driver storageframework.TestDri
330335
331336 ginkgo .By ("Checking that the sidecar container is using the custom image" )
332337 tPod .VerifyCustomSidecarContainerImage (supportsNativeSidecar , hasMetadataPrefetch )
333-
334- ginkgo .By ("Checking that the pod command exits with no error" )
335- tPod .VerifyExecInPodSucceed (f , specs .TesterContainerName , fmt .Sprintf ("mount | grep %v | grep rw," , mountPath ))
336- tPod .VerifyExecInPodSucceed (f , specs .TesterContainerName , fmt .Sprintf ("echo 'hello world' > %v/data && grep 'hello world' %v/data" , mountPath , mountPath ))
338+ // Do not check pod exec for hostnetwork, as we do not expect it to work until we support this feature for private sidecars.
339+ if configPrefix != specs .EnableHostNetworkPrefix {
340+ ginkgo .By ("Checking that the pod command exits with no error" )
341+ tPod .VerifyExecInPodSucceed (f , specs .TesterContainerName , fmt .Sprintf ("mount | grep %v | grep rw," , mountPath ))
342+ tPod .VerifyExecInPodSucceed (f , specs .TesterContainerName , fmt .Sprintf ("echo 'hello world' > %v/data && grep 'hello world' %v/data" , mountPath , mountPath ))
343+ }
337344 }
338345
339346 ginkgo .It ("should store data using custom sidecar container image" , func () {
340347 testCaseStoreDataCustomContainerImage ("" )
341348 })
349+ ginkgo .It ("should mount normally for hostnetwork using custom sidecar container image" , func () {
350+ testCaseStoreDataCustomContainerImage (specs .EnableHostNetworkPrefix )
351+ })
342352 ginkgo .It ("[csi-skip-bucket-access-check] should store data using custom sidecar container image" , func () {
343353 testCaseStoreDataCustomContainerImage (specs .SkipCSIBucketAccessCheckPrefix )
344354 })
0 commit comments