@@ -136,6 +136,8 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
136136 type local struct {
137137 config * storageframework.PerTestConfig
138138 volumeResource * storageframework.VolumeResource
139+ gcsfuseVersion * version.Version
140+ gcsfuseBranch string
139141 }
140142 var l local
141143 ctx := context .Background ()
@@ -160,8 +162,13 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
160162 err := utilerrors .NewAggregate (cleanUpErrs )
161163 framework .ExpectNoError (err , "while cleaning up" )
162164 }
163- gcsfuseVersion , branch := specs .GCSFuseVersionAndBranch (gcsfuseVersionStr )
164- kernelParamsSupported := branch == utils .MasterBranchName || gcsfuseVersion .AtLeast (version .MustParseSemantic (utils .MinGCSFuseKernelParamsVersion ))
165+
166+ isKernelParamSupported := func (ctx context.Context , f * framework.Framework ) bool {
167+ if l .gcsfuseBranch != "" || l .gcsfuseVersion == nil {
168+ l .gcsfuseVersion , l .gcsfuseBranch = specs .GCSFuseVersionAndBranch (ctx , f )
169+ }
170+ return l .gcsfuseBranch == utils .MasterBranchName || l .gcsfuseVersion .AtLeast (version .MustParseSemantic (utils .MinGCSFuseKernelParamsVersion ))
171+ }
165172
166173 // skipTestOrProceedWithBranch works by skipping tests for gcsfuse versions that do not support them.
167174 // These tests run against all non-managed driver versions, and for selected gke managed driver versions. This is because when
@@ -237,7 +244,6 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
237244 gcsfuseVersionStr = specs .GetGCSFuseVersion (ctx , f )
238245 }
239246 gcsfuseVersion := version .MustParseSemantic (gcsfuseVersionStr )
240- stripUnsupportedMountOptions (& mountOptions , gcsfuseVersion )
241247
242248 ginkgo .By (fmt .Sprintf ("Running integration test %v with GCSFuse version %v" , testName , gcsfuseVersionStr ))
243249 gcsfuseTestBranch := skipTestOrProceedWithBranch (gcsfuseVersionStr , testName )
@@ -565,7 +571,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
565571 init ()
566572 defer cleanup ()
567573 mountOptions := []string {"implicit-dirs=true" }
568- if kernelParamsSupported {
574+ if isKernelParamSupported ( ctx , f ) {
569575 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
570576 }
571577 gcsfuseIntegrationTest (testNameReadLargeFiles , false , mountOptions ... )
@@ -632,7 +638,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
632638 defer cleanup ()
633639
634640 mountOptions := []string {"implicit-dirs=true" , "kernel-list-cache-ttl-secs=-1" }
635- if kernelParamsSupported {
641+ if isKernelParamSupported ( ctx , f ) {
636642 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
637643 }
638644 gcsfuseIntegrationTest (testNameConcurrentOperations , false , mountOptions ... )
@@ -761,7 +767,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
761767 init ()
762768 defer cleanup ()
763769 mountOptions := []string {"read-inactive-stream-timeout=0s" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , inactive_stream_timeout_log_file ), "log-severity=trace" }
764- if kernelParamsSupported {
770+ if isKernelParamSupported ( ctx , f ) {
765771 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
766772 }
767773 gcsfuseIntegrationTest (testNameInactiveStreamTimeout + ":TestTimeoutDisabledSuite" , false , mountOptions ... )
@@ -771,7 +777,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
771777 init ()
772778 defer cleanup ()
773779 mountOptions := []string {"read-inactive-stream-timeout=1s" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , inactive_stream_timeout_log_file ), "log-severity=trace" }
774- if kernelParamsSupported {
780+ if isKernelParamSupported ( ctx , f ) {
775781 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
776782 }
777783 gcsfuseIntegrationTest (testNameInactiveStreamTimeout + ":TestTimeoutEnabledSuite/TestReaderCloses" , false , mountOptions ... )
@@ -781,7 +787,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
781787 init ()
782788 defer cleanup ()
783789 mountOptions := []string {"read-inactive-stream-timeout=1s" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , inactive_stream_timeout_log_file ), "log-severity=trace" }
784- if kernelParamsSupported {
790+ if isKernelParamSupported ( ctx , f ) {
785791 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
786792 }
787793 gcsfuseIntegrationTest (testNameInactiveStreamTimeout + ":TestTimeoutEnabledSuite/TestReaderStaysOpenWithinTimeout" , false , mountOptions ... )
@@ -791,7 +797,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
791797 init ()
792798 defer cleanup ()
793799 mountOptions := []string {"enable-buffered-read" , "read-block-size-mb=8" , "read-max-blocks-per-handle=20" , "read-start-blocks-per-handle=1" , "read-min-blocks-per-handle=2" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , buffered_reads_log_file ), "log-severity=trace" }
794- if kernelParamsSupported {
800+ if isKernelParamSupported ( ctx , f ) {
795801 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
796802 }
797803 gcsfuseIntegrationTest (testNameBufferedReads + ":TestSequentialReadSuite" , false , mountOptions ... )
@@ -801,7 +807,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
801807 init ()
802808 defer cleanup ()
803809 mountOptions := []string {"enable-buffered-read" , "read-block-size-mb=8" , "read-max-blocks-per-handle=20" , "read-start-blocks-per-handle=2" , "read-min-blocks-per-handle=2" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , buffered_reads_log_file ), "log-severity=trace" }
804- if kernelParamsSupported {
810+ if isKernelParamSupported ( ctx , f ) {
805811 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
806812 }
807813 gcsfuseIntegrationTest (testNameBufferedReads + ":TestFallbackSuites/TestRandomRead_LargeFile_Fallback" , false , mountOptions ... )
@@ -811,7 +817,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
811817 init ()
812818 defer cleanup ()
813819 mountOptions := []string {"enable-buffered-read" , "read-block-size-mb=8" , "read-max-blocks-per-handle=20" , "read-start-blocks-per-handle=2" , "read-min-blocks-per-handle=2" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , buffered_reads_log_file ), "log-severity=trace" }
814- if kernelParamsSupported {
820+ if isKernelParamSupported ( ctx , f ) {
815821 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
816822 }
817823 gcsfuseIntegrationTest (testNameBufferedReads + ":TestFallbackSuites/TestRandomRead_SmallFile_NoFallback" , false , mountOptions ... )
@@ -821,7 +827,7 @@ func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframew
821827 init ()
822828 defer cleanup ()
823829 mountOptions := []string {"enable-buffered-read" , "read-block-size-mb=8" , "read-max-blocks-per-handle=10" , "read-start-blocks-per-handle=2" , "read-min-blocks-per-handle=2" , "read-global-max-blocks=1" , "logging:format:json" , fmt .Sprintf ("logging:file-path:%s" , buffered_reads_log_file ), "log-severity=trace" }
824- if kernelParamsSupported {
830+ if isKernelParamSupported ( ctx , f ) {
825831 mountOptions = append (mountOptions , "file-system:enable-kernel-reader:false" )
826832 }
827833 gcsfuseIntegrationTest (testNameBufferedReads + ":TestFallbackSuites/TestNewBufferedReader_InsufficientGlobalPool_NoReaderAdded" , false , mountOptions ... )
0 commit comments