forked from GoogleCloudPlatform/gcs-fuse-csi-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcsfuse_integration.go
More file actions
945 lines (771 loc) · 41.2 KB
/
gcsfuse_integration.go
File metadata and controls
945 lines (771 loc) · 41.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
/*
Copyright 2018 The Kubernetes Authors.
Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package testsuites
import (
"context"
"fmt"
"strings"
"local/test/e2e/specs"
"local/test/e2e/utils"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
e2evolume "k8s.io/kubernetes/test/e2e/framework/volume"
storageframework "k8s.io/kubernetes/test/e2e/storage/framework"
admissionapi "k8s.io/pod-security-admission/api"
)
const (
gcsfuseIntegrationTestsBasePath = "gcsfuse/tools/integration_tests"
testNameOperations = "operations"
testNameReadonly = "readonly"
testNameRenameDirLimit = "rename_dir_limit"
testNameImplicitDir = "implicit_dir"
testNameExplicitDir = "explicit_dir"
testNameReadLargeFiles = "read_large_files"
testNameWriteLargeFiles = "write_large_files"
testNameGzip = "gzip"
testNameLocalFile = "local_file"
testNameListLargeDir = "list_large_dir"
testNameManagedFolders = "managed_folders"
testNameConcurrentOperations = "concurrent_operations"
testNameKernelListCache = "kernel_list_cache"
testNameEnableStreamingWrites = "streaming_writes"
testNameInactiveStreamTimeout = "inactive_stream_timeout"
testNameBufferedReads = "buffered_read"
testNameRenameSymlink = "rename_symlink"
testNameRapidAppends = "rapid_appends"
testNamePrefixSucceed = "should succeed in "
defaultSidecarMemoryLimit = "1Gi"
defaultSidecarMemoryRequest = "512Mi"
// In order to pass anything to the sidecar, you need to pass it via the mountPaths that the sidecar injects.
// So for temporary files, that would be mountPath: /gcsfuse-tmp, via the gke-gcsfuse-tmp volume.
inactive_stream_timeout_log_file = "/gcsfuse-tmp/log.json"
buffered_reads_log_file = "/gcsfuse-tmp/log.json"
gkeTempDir = "/gcsfuse-tmp"
gcsfuseGoEnvSetupFormat = "export GO_VERSION=$(%v) && export GOTOOLCHAIN=go$GO_VERSION && export PATH=$PATH:/usr/local/go/bin"
)
// testPackageTimeoutMap controls the duration of the `-timeout` flag passed to the underlying `go test` executions.
// If you need to extend the timeout for a specific test package, add or modify its limit in minutes here.
var testPackageTimeoutMap = map[string]int{
testNameListLargeDir: 60,
testNameWriteLargeFiles: 60,
testNameReadLargeFiles: 60,
testNameRapidAppends: 60,
}
var GCSFuseVersionStr = ""
const gcsfuseGoVersionLegacyCommand = `grep -o 'go[0-9]\+\.[0-9]\+\.[0-9]\+' ./gcsfuse/tools/cd_scripts/e2e_test.sh | cut -c3-`
const gcsfuseCentralizedLocationGoVersionCommand = `cat ./gcsfuse/.go-version | tr -d '[:space:]'`
func hnsEnabled(driver storageframework.TestDriver) bool {
gcsfuseCSITestDriver, ok := driver.(*specs.GCSFuseCSITestDriver)
gomega.Expect(ok).To(gomega.BeTrue(), "failed to cast storageframework.TestDriver to *specs.GCSFuseCSITestDriver")
return gcsfuseCSITestDriver.EnableHierarchicalNamespace
}
// zbEnabled checks if the Zonal Buckets feature is enabled for the given driver.
// It is needs to be used in the integration test commands because gcsfuse tests parallelize and disabled tests based on this --zonal flag.
// Gcsfuse team adds this in this commit https://github.com/GoogleCloudPlatform/gcsfuse/commit/c9a273daf6028ac90dd18f35e74014763d5aa03c.
func zbEnabled(driver storageframework.TestDriver) bool {
gcsfuseCSITestDriver, ok := driver.(*specs.GCSFuseCSITestDriver)
gomega.Expect(ok).To(gomega.BeTrue(), "failed to cast storageframework.TestDriver to *specs.GCSFuseCSITestDriver")
return gcsfuseCSITestDriver.EnableZB
}
// flatEnabled checks if the Flat Namespace feature is enabled for the given driver.
func flatEnabled(driver storageframework.TestDriver) bool {
gcsfuseCSITestDriver, ok := driver.(*specs.GCSFuseCSITestDriver)
gomega.Expect(ok).To(gomega.BeTrue(), "failed to cast storageframework.TestDriver to *specs.GCSFuseCSITestDriver")
return !gcsfuseCSITestDriver.EnableHierarchicalNamespace && !gcsfuseCSITestDriver.EnableZB
}
// isConfigCompatible returns true if the parsed config is compatible with the current driver setup.
func isConfigCompatible(config utils.TestConfig, driver storageframework.TestDriver) bool {
if !config.RunOnGke {
return false
}
if !config.Compatible.Flat && flatEnabled(driver) {
return false
}
if !config.Compatible.HNS && hnsEnabled(driver) && !zbEnabled(driver) {
return false
}
if !config.Compatible.Zonal && zbEnabled(driver) {
return false
}
return true
}
// getGoParsingCommand returns the command to get the go version for the gcsfuse integration tests based on the gcsfuse version and branch.
// In gcsfuse v3.7.0 the go location was moved to a centralized dir ./gcsfuse/.go-version.
// If using v3.6.0 or older, we use gcsfuseGoVersionLegacyCommand; otherwise we use gcsfuseCentralizedLocationGoVersionCommand.
func getGoParsingCommand(gcsfuseVersion version.Version, gcsfuseTestBranch string) string {
gcsfuseGoVersionCommand := gcsfuseGoVersionLegacyCommand
if gcsfuseTestBranch == utils.MasterBranchName || gcsfuseVersion.AtLeast(version.MustParseSemantic("v3.7.0-gke.0")) {
gcsfuseGoVersionCommand = gcsfuseCentralizedLocationGoVersionCommand
}
return gcsfuseGoVersionCommand
}
func getClientProtocol(driver storageframework.TestDriver) string {
gcsfuseCSITestDriver, ok := driver.(*specs.GCSFuseCSITestDriver)
gomega.Expect(ok).To(gomega.BeTrue(), "failed to cast storageframework.TestDriver to *specs.GCSFuseCSITestDriver")
return gcsfuseCSITestDriver.ClientProtocol
}
type TestCommandConfig struct {
TestPkg string
TestName string
GoEnvSetupCmd string
MountPath string
SecondaryMountPath string // Optional
BucketName string
OnlyDir string
}
// generateTestCommand constructs the test command for validating file cache parameters.
// This is used dynamically across the file cache logic tests including parallel downloads.
func generateTestCommand(opts TestCommandConfig) string {
timeoutStr := ""
if t, ok := testPackageTimeoutMap[opts.TestPkg]; ok {
timeoutStr = fmt.Sprintf(" -timeout %dm", t)
}
goTestCmd := fmt.Sprintf("GODEBUG=asyncpreemptoff=1 go test ./%v/... -p 1 --integrationTest -v --config-file=../test_config.yaml%s", opts.TestPkg, timeoutStr)
if opts.TestName != "" {
goTestCmd = fmt.Sprintf("GODEBUG=asyncpreemptoff=1 go test ./%v/... -p 1 --integrationTest -v -run ^%v$ --config-file=../test_config.yaml%s", opts.TestPkg, opts.TestName, timeoutStr)
}
commandArgs := []string{
fmt.Sprintf(gcsfuseGoEnvSetupFormat, opts.GoEnvSetupCmd),
fmt.Sprintf("export MOUNTED_DIR=%q", opts.MountPath),
}
if opts.SecondaryMountPath != "" {
commandArgs = append(commandArgs, fmt.Sprintf("export MOUNTED_DIR_SECONDARY=%q", opts.SecondaryMountPath))
}
commandArgs = append(commandArgs,
fmt.Sprintf("export BUCKET_NAME=%q", opts.BucketName),
fmt.Sprintf("export ONLY_DIR=%q", opts.OnlyDir),
fmt.Sprintf("cd %v", gcsfuseIntegrationTestsBasePath),
goTestCmd,
)
return strings.Join(commandArgs, " && ")
}
// configureLargeFileResources configures the pod and sidecar resources for memory-intensive large file tests.
// Note: We only increase memory limits for specific tests like testNameWriteLargeFiles, testNameReadLargeFiles
// and testNameRapidAppends. Other test cases run stable within the default memory for now
// limits and do not require additional resources.
func configureLargeFileResources(tPod *specs.TestPod, testNameOrPkg string, driver storageframework.TestDriver) (string, string) {
sidecarMemoryLimit := defaultSidecarMemoryLimit
sidecarMemoryRequest := defaultSidecarMemoryRequest
if testNameOrPkg == testNameWriteLargeFiles || testNameOrPkg == testNameReadLargeFiles {
tPod.SetResource("1", "8Gi", "5Gi")
sidecarMemoryLimit = "1Gi"
if zbEnabled(driver) {
sidecarMemoryRequest = "1Gi"
sidecarMemoryLimit = "2Gi"
}
}
if testNameOrPkg == testNameRapidAppends {
tPod.SetResource("1", "3Gi", "5Gi")
sidecarMemoryRequest = "2Gi"
sidecarMemoryLimit = "3Gi"
}
return sidecarMemoryRequest, sidecarMemoryLimit
}
type gcsFuseCSIGCSFuseIntegrationTestSuite struct {
tsInfo storageframework.TestSuiteInfo
}
// InitGcsFuseCSIGCSFuseIntegrationTestSuite returns gcsFuseCSIGCSFuseIntegrationTestSuite that implements TestSuite interface.
func InitGcsFuseCSIGCSFuseIntegrationTestSuite() storageframework.TestSuite {
return &gcsFuseCSIGCSFuseIntegrationTestSuite{
tsInfo: storageframework.TestSuiteInfo{
Name: "gcsfuseIntegration",
TestPatterns: []storageframework.TestPattern{
storageframework.DefaultFsCSIEphemeralVolume,
},
},
}
}
func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) GetTestSuiteInfo() storageframework.TestSuiteInfo {
return t.tsInfo
}
func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) SkipUnsupportedTests(_ storageframework.TestDriver, _ storageframework.TestPattern) {
}
func (t *gcsFuseCSIGCSFuseIntegrationTestSuite) DefineTests(driver storageframework.TestDriver, pattern storageframework.TestPattern) {
type local struct {
config *storageframework.PerTestConfig
volumeResource *storageframework.VolumeResource
gcsfuseVersion *version.Version
gcsfuseBranch string
}
var l local
ctx := context.Background()
// Beware that it also registers an AfterEach which renders f unusable. Any code using
// f must run inside an It or Context callback.
f := framework.NewFrameworkWithCustomTimeouts("gcsfuse-integration", storageframework.GetDriverTimeouts(driver))
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
init := func(configPrefix ...string) {
l = local{}
l.config = driver.PrepareTest(ctx, f)
if len(configPrefix) > 0 {
l.config.Prefix = configPrefix[0]
}
l.volumeResource = storageframework.CreateVolumeResource(ctx, driver, l.config, pattern, e2evolume.SizeRange{})
}
cleanup := func() {
var cleanUpErrs []error
cleanUpErrs = append(cleanUpErrs, l.volumeResource.CleanupResource(ctx))
err := utilerrors.NewAggregate(cleanUpErrs)
framework.ExpectNoError(err, "while cleaning up")
}
isKernelParamSupported := func() bool {
if l.gcsfuseBranch != "" || l.gcsfuseVersion == nil {
l.gcsfuseVersion, l.gcsfuseBranch = specs.GCSFuseVersionAndBranch()
}
return l.gcsfuseBranch == utils.MasterBranchName || l.gcsfuseVersion.AtLeast(version.MustParseSemantic(utils.MinGCSFuseKernelParamsVersion))
}
// skipTestOrProceedWithBranch works by skipping tests for gcsfuse versions that do not support them.
// These tests run against all non-managed driver versions, and for selected gke managed driver versions. This is because when
// we build the non-managed driver, we build gcsfuse from master and assign a tag of 999 to that build. This automatically
// qualifies the non-managed driver to run all the tests.
skipTestOrProceedWithBranch := func(gcsfuseVersionStr, testName string) string {
v, branch := utils.GCSFuseBranch(gcsfuseVersionStr)
// Rename_symlink tests are in separat test package only of v2.11.4 for now
if testName == testNameRenameSymlink && (branch == utils.MasterBranchName || (v.AtLeast(version.MustParseSemantic("v3.0.0-gke.0")) || v.LessThan(version.MustParseSemantic("v2.11.4-gke.0")))) {
e2eskipper.Skipf("skip gcsfuse integration rename_symlink test on gcsfuse version %v", v.String())
}
if branch == utils.MasterBranchName {
return branch
}
// If the GCSFuse version is exactly v3.0.0, use the master branch to fetch the tests.
// This is because GCSFuse made test fixes to read_large_files and local_file tests,
// after the v3.0.0 release as cut, and we don't want to block the release on them
// creating a new patch version for this. After v3.1.0 is fully rolled out, and we
// confirm we are no longer running CI tests on v3.0.0, we should remove this block.
// v.EqualTo is only supported in k8s.io/apimachinery v0.31.0, and we are still using
// v0.30.
if v.AtLeast(version.MustParseSemantic("v3.0.0-gke.0")) && v.LessThan(version.MustParseSemantic("v3.1.0-gke.0")) {
return utils.MasterBranchName
}
// check if the given gcsfuse version supports the test case
if !v.AtLeast(version.MustParseSemantic("v2.3.1-gke.0")) {
if testName == testNameListLargeDir || testName == testNameConcurrentOperations || testName == testNameKernelListCache {
e2eskipper.Skipf("skip gcsfuse integration test %v for gcsfuse version %v", testName, v.String())
}
}
// HNS is supported after v2.5.0
if !v.AtLeast(version.MustParseSemantic("v2.5.0-gke.0")) && (hnsEnabled(driver) || zbEnabled(driver)) {
e2eskipper.Skipf("skip gcsfuse integration HNS tests on gcsfuse version %v", v.String())
}
// GCSFuse flag enable-streaming-writes is supported after v2.9.0.
if !v.AtLeast(version.MustParseSemantic("v2.9.0-gke.0")) && testName == testNameEnableStreamingWrites {
e2eskipper.Skipf("skip gcsfuse integration test %v for gcsfuse version %v", testNameEnableStreamingWrites, v.String())
}
// tests are added or modified after v2.3.1 release and before v2.4.0 release
if !v.AtLeast(version.MustParseSemantic("v2.4.0-gke.0")) && (testName == testNameListLargeDir || testName == testNameConcurrentOperations || testName == testNameKernelListCache || testName == testNameLocalFile) {
return "v2.4.0"
}
// GCSFuse inactive_stream_timeout tests are supported after v3.1.0.
if !v.AtLeast(version.MustParseSemantic("v3.1.0-gke.0")) && testName == testNameInactiveStreamTimeout {
e2eskipper.Skipf("skip gcsfuse integration test %v for gcsfuse version %v", testNameInactiveStreamTimeout, v.String())
}
// GCSFuse buffered_read tests are supported after v3.3.0-gke.1.
if !v.AtLeast(version.MustParseSemantic("v3.3.0-gke.1")) && testName == testNameBufferedReads {
e2eskipper.Skipf("skip gcsfuse integration test %v for gcsfuse version %v", testNameBufferedReads, v.String())
}
return branch
}
gcsfuseIntegrationTest := func(testName string, readOnly bool, mountOptions ...string) {
testCase := ""
if strings.HasPrefix(testName, testNameKernelListCache) || strings.HasPrefix(testName, testNameManagedFolders) || strings.HasPrefix(testName, testNameInactiveStreamTimeout) || strings.HasPrefix(testName, testNameBufferedReads) {
l := strings.Split(testName, ":")
testCase = l[1]
testName = l[0]
}
ginkgo.By("Checking GCSFuse version and skip test if needed")
// Check if the GCSFuseVersion is already set, if not, we should set it.
// This is for the case that we run this test suite individually.
if GCSFuseVersionStr == "" {
GCSFuseVersionStr = specs.GetGCSFuseVersion()
}
gcsfuseVersion := version.MustParseSemantic(GCSFuseVersionStr)
ginkgo.By(fmt.Sprintf("Running integration test %v with GCSFuse version %v", testName, GCSFuseVersionStr))
gcsfuseTestBranch := skipTestOrProceedWithBranch(GCSFuseVersionStr, testName)
ginkgo.By(fmt.Sprintf("Running integration test %v with GCSFuse branch %v", testName, gcsfuseTestBranch))
ginkgo.By("Configuring the test pod")
tPod := specs.NewTestPod(f.ClientSet, f.Namespace)
tPod.SetImage(specs.GolangImage)
tPod.SetResource("1", "5Gi", "5Gi")
sidecarMemoryRequest, sidecarMemoryLimit := configureLargeFileResources(tPod, testName, driver)
mo := l.volumeResource.VolSource.CSI.VolumeAttributes["mountOptions"]
if testName == testNameExplicitDir && strings.Contains(mo, "only-dir") {
mo = strings.ReplaceAll(mo, "implicit-dirs,", "")
}
mo = strings.ReplaceAll(mo, "logging:severity:info", "logging:severity:trace")
l.volumeResource.VolSource.CSI.VolumeAttributes["mountOptions"] = mo
tPod.SetupVolume(l.volumeResource, volumeName, mountPath, readOnly, mountOptions...)
tPod.SetAnnotations(map[string]string{
"gke-gcsfuse/cpu-limit": "1",
"gke-gcsfuse/memory-request": sidecarMemoryRequest,
"gke-gcsfuse/memory-limit": sidecarMemoryLimit,
"gke-gcsfuse/ephemeral-storage-limit": "2Gi",
})
bucketName := l.volumeResource.VolSource.CSI.VolumeAttributes["bucketName"]
dirPath := ""
for _, o := range strings.Split(mo, ",") {
kv := strings.Split(o, "=")
if len(kv) == 2 && kv[0] == "only-dir" {
dirPath = kv[1]
}
}
if dirPath != "" {
if !(testName == testNameRenameDirLimit && hnsEnabled(driver)) {
bucketName += "/" + dirPath
}
}
if hnsEnabled(driver) {
tPod.SetupVolumeForHNS(volumeName)
}
if testName == testNameInactiveStreamTimeout {
// This needs to match what gcsfuse sets here:
// https://github.com/GoogleCloudPlatform/gcsfuse/blob/bb28c11b229d5c2706cbb0abb9eb8634363b3799/tools/integration_tests/inactive_stream_timeout/setup_test.go#L45.
// The gcsfuse integration tests are run from the main container, which has this hardcoded value. After the tests are setup,
// the gcsfuse process is started in the sidecar container. Our webhook auto injects some volumeMounts into the sidecar, so we
// we need to use one of these volume mountPaths below. For this test, we use `/gcsfuse-tmp/<filename>` as the log file to the gcsfuse integration test below.
inactive_stream_timeout_log_dir := "/tmp/inactive_stream_timeout_logs"
tPod.SetupTmpVolumeMount(inactive_stream_timeout_log_dir)
}
if testName == testNameBufferedReads {
// This needs to match what gcsfuse sets here:
// https://github.com/GoogleCloudPlatform/gcsfuse/blob/94e4ade71cfa056bc3dd18a573bfbbb7cc4ae765/tools/integration_tests/buffered_read/setup_test.go#L36.
// The gcsfuse integration tests are run from the main container, which has this hardcoded value. After the tests are setup,
// the gcsfuse process is started in the sidecar container. Our webhook auto injects some volumeMounts into the sidecar, so we
// we need to use one of these volume mountPaths below. For this test, we use `/gcsfuse-tmp/<filename>` as the log file to the gcsfuse integration test below.
buffered_reads_log_dir := "/tmp/gcsfuse_buffered_read_test_logs"
tPod.SetupTmpVolumeMount(buffered_reads_log_dir)
}
ginkgo.By("Deploying the test pod")
tPod.Create(ctx)
defer tPod.Cleanup(ctx)
ginkgo.By("Checking that the test pod is running")
tPod.WaitForRunning(ctx)
ginkgo.By("Checking that the test pod command exits with no error")
if readOnly {
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, fmt.Sprintf("mount | grep %v | grep ro,", mountPath))
} else {
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, fmt.Sprintf("mount | grep %v | grep rw,", mountPath))
}
ginkgo.By("Installing dependencies")
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, fmt.Sprintf("git clone --branch %v https://github.com/GoogleCloudPlatform/gcsfuse.git", gcsfuseTestBranch))
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, "apt-get install -y apt-transport-https ca-certificates gnupg curl")
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, "curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg")
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, "echo 'deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main' | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list")
tPod.VerifyExecInPodSucceed(f, specs.TesterContainerName, "ln -s /usr/bin/python3 /usr/bin/python")
tPod.VerifyExecInPodSucceedWithFullOutput(f, specs.TesterContainerName, "apt-get update && apt-get install -y google-cloud-cli")
ginkgo.By("Getting gcsfuse testsuite go version")
gcsfuseGoVersionCommand := getGoParsingCommand(*gcsfuseVersion, gcsfuseTestBranch)
gcsfuseTestSuiteVersion := tPod.VerifyExecInPodSucceedWithOutput(f, specs.TesterContainerName, gcsfuseGoVersionCommand)
ginkgo.By("Checking that the gcsfuse integration tests exits with no error")
baseTestCommand := fmt.Sprintf("export GOTOOLCHAIN=go%v && export PATH=$PATH:/usr/local/go/bin && cd %v/%v && GODEBUG=asyncpreemptoff=1 go test . -p 1 --integrationTest -v --mountedDirectory=%v", gcsfuseTestSuiteVersion, gcsfuseIntegrationTestsBasePath, testName, mountPath)
if zbEnabled(driver) {
baseTestCommand += " --zonal=true"
}
baseTestCommandWithTestBucket := baseTestCommand + fmt.Sprintf(" --testbucket=%v", bucketName)
var finalTestCommand string
switch testName {
case testNameReadonly:
if readOnly {
finalTestCommand = baseTestCommandWithTestBucket
} else {
finalTestCommand = fmt.Sprintf("chmod 777 %v/readonly && useradd -u 6666 -m test-user && su test-user -c '%v'", gcsfuseIntegrationTestsBasePath, baseTestCommandWithTestBucket)
}
case testNameExplicitDir, testNameImplicitDir, testNameGzip, testNameLocalFile, testNameOperations, testNameEnableStreamingWrites:
finalTestCommand = baseTestCommandWithTestBucket
case testNameConcurrentOperations:
// Only run selected tests until gcsfuse team optimizes memory usage of their new sub-tests.
// https://github.com/GoogleCloudPlatform/gcsfuse/tree/master/tools/integration_tests/concurrent_operations
finalTestCommand = baseTestCommandWithTestBucket + " -run TestConcurrentListing/.*"
case testNameRenameDirLimit:
if gcsfuseTestBranch == utils.MasterBranchName || gcsfuseVersion.AtLeast(version.MustParseSemantic("v2.4.1-gke.0")) {
finalTestCommand = baseTestCommandWithTestBucket
} else {
finalTestCommand = baseTestCommand
}
case testNameKernelListCache, testNameManagedFolders, testNameInactiveStreamTimeout, testNameBufferedReads:
finalTestCommand = baseTestCommandWithTestBucket + " -run " + testCase
case testNameListLargeDir, testNameWriteLargeFiles:
finalTestCommand = baseTestCommandWithTestBucket + " -timeout 120m"
case testNameReadLargeFiles:
if gcsfuseTestBranch == utils.MasterBranchName || gcsfuseVersion.AtLeast(version.MustParseSemantic("v2.4.1-gke.0")) {
finalTestCommand = baseTestCommandWithTestBucket + " -timeout 60m"
} else {
finalTestCommand = baseTestCommand + " -timeout 60m"
}
case testNameRenameSymlink:
finalTestCommand = baseTestCommandWithTestBucket
default:
finalTestCommand = baseTestCommand
}
tPod.VerifyExecInPodSucceedWithFullOutput(f, specs.TesterContainerName, finalTestCommand)
}
testNameSuffix := func(i int) string {
return fmt.Sprintf(" test %v", i)
}
// The following test cases are derived from https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/tools/integration_tests/run_tests_mounted_directory.sh
ginkgo.It(testNamePrefixSucceed+testNameOperations+testNameSuffix(1), func() {
if hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v with flag implicit-dirs when HNS is enabled", testNameOperations)
}
init()
defer cleanup()
gcsfuseIntegrationTest(testNameOperations, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameOperations+testNameSuffix(2), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameOperations, false, "implicit-dirs=false")
})
ginkgo.It(testNamePrefixSucceed+testNameOperations+testNameSuffix(3), func() {
if hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v with flag implicit-dirs when HNS is enabled", testNameOperations)
}
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameOperations, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameOperations+testNameSuffix(4), func() {
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameOperations, false, "implicit-dirs=false")
})
ginkgo.It(testNamePrefixSucceed+testNameOperations+testNameSuffix(5), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameOperations, false, "write:create-empty-file:true")
})
ginkgo.It(testNamePrefixSucceed+testNameReadonly+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameReadonly, true, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameReadonly+testNameSuffix(2), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameReadonly, false, "file-mode=544", "dir-mode=544", "uid=6666", "gid=6666", "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameReadonly+testNameSuffix(3), func() {
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameReadonly, true, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameReadonly+testNameSuffix(4), func() {
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameReadonly, false, "file-mode=544", "dir-mode=544", "uid=6666", "gid=6666", "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameRenameDirLimit+testNameSuffix(1), func() {
if hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v with flag implicit-dirs when HNS is enabled", testNameRenameDirLimit)
}
init()
defer cleanup()
gcsfuseIntegrationTest(testNameRenameDirLimit, false, "rename-dir-limit=3", "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameRenameDirLimit+testNameSuffix(2), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameRenameDirLimit, false, "rename-dir-limit=3", "implicit-dirs=false")
})
ginkgo.It(testNamePrefixSucceed+testNameRenameDirLimit+testNameSuffix(3), func() {
if hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v with flag implicit-dirs when HNS is enabled", testNameRenameDirLimit)
}
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameRenameDirLimit, false, "rename-dir-limit=3", "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameRenameDirLimit+testNameSuffix(4), func() {
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameRenameDirLimit, false, "rename-dir-limit=3", "implicit-dirs=false")
})
ginkgo.It(testNamePrefixSucceed+testNameImplicitDir+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameImplicitDir, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameImplicitDir+testNameSuffix(2), func() {
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameImplicitDir, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameExplicitDir+testNameSuffix(1), func() {
if hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v when HNS is enabled", testNameExplicitDir)
}
init()
defer cleanup()
gcsfuseIntegrationTest(testNameExplicitDir, false, "implicit-dirs=false")
})
ginkgo.It(testNamePrefixSucceed+testNameExplicitDir+testNameSuffix(2), func() {
if hnsEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v when HNS is enabled", testNameExplicitDir)
}
// passing only-dir flags
init(specs.SubfolderInBucketPrefix)
defer cleanup()
gcsfuseIntegrationTest(testNameExplicitDir, false, "implicit-dirs=false")
})
ginkgo.It(testNamePrefixSucceed+testNameListLargeDir+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameListLargeDir, false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameReadLargeFiles+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameReadLargeFiles, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameReadLargeFiles+testNameSuffix(2), func() {
if !zbEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v with file-system:enable-kernel-reader:false as it requires zonal buckets", testNameReadLargeFiles)
}
init()
defer cleanup()
mountOptions := []string{"implicit-dirs=true"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameReadLargeFiles, false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameWriteLargeFiles+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameWriteLargeFiles, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameWriteLargeFiles+testNameSuffix(2), func() {
init()
defer cleanup()
v, err := version.ParseSemantic(GCSFuseVersionStr)
// If error != nil, this means we've autogenerated a tag (meaning we run from HEAD)
// Otherise, we have a valid tag, and we compare against the supported release.
if (err != nil || v.AtLeast(version.MustParseSemantic("2.9.0-gke.0"))) && getClientProtocol(driver) != "grpc" {
gcsfuseIntegrationTest(testNameWriteLargeFiles, false, "enable-streaming-writes", "implicit-dirs=true")
} else {
e2eskipper.Skipf("skip gcsfuse integration test %v with enable-streaming-writes", testNameWriteLargeFiles)
}
})
ginkgo.It(testNamePrefixSucceed+testNameGzip+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameGzip, false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameLocalFile+testNameSuffix(1), func() {
init()
defer cleanup()
v, err := version.ParseSemantic(GCSFuseVersionStr)
// If error != nil, this means we've autogenerated a tag (meaning we run from HEAD)
// Otherise, we have a valid tag, and we compare against the supported release.
if err != nil || v.AtLeast(version.MustParseSemantic("3.0.0-gke.0")) {
ginkgo.By("Running test supported for gcsfuse v3.0.0+")
// I needed to disable streaming writes the config file method, to
// avoid gcsfuse exiting with Error: accepts between 2 and 3 arg(s), received 4.
gcsfuseIntegrationTest(testNameLocalFile, false, "implicit-dirs=true", "rename-dir-limit=3", "write:enable-streaming-writes:false")
} else {
ginkgo.By("Running test supported before gcsfuse v3.0.0")
gcsfuseIntegrationTest(testNameLocalFile, false, "implicit-dirs=true", "rename-dir-limit=3")
}
})
ginkgo.It(testNamePrefixSucceed+testNameConcurrentOperations+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameConcurrentOperations, false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameConcurrentOperations+testNameSuffix(2), func() {
if !zbEnabled(driver) {
e2eskipper.Skipf("skip gcsfuse integration test %v with file-system:enable-kernel-reader:false as it requires zonal buckets", testNameConcurrentOperations)
}
init()
defer cleanup()
mountOptions := []string{"implicit-dirs=true", "kernel-list-cache-ttl-secs=-1"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameConcurrentOperations, false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_AlwaysCacheHit", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(2), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_CacheMissOnAdditionOfFile", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(3), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_CacheMissOnDeletionOfFile", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(4), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_CacheMissOnFileRename", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(5), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_EvictCacheEntryOfOnlyDirectParent", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(6), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_CacheMissOnAdditionOfDirectory", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(7), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_CacheMissOnDeletionOfDirectory", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(8), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_CacheMissOnDirectoryRename", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(9), func() {
init()
defer cleanup()
v, err := version.ParseSemantic(GCSFuseVersionStr)
// If error != nil, this means we've autogenerated a tag (meaning we run from HEAD)
// Otherise, we have a valid tag, and we compare against the supported release.
if err != nil || v.AtLeast(version.MustParseSemantic("2.7.0-gke.0")) {
ginkgo.By("Running test supported for gcsfuse v2.7.0+")
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheDeleteDirTest/TestKernelListCache_ListAndDeleteDirectory", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1", "metadata-cache-ttl-secs=0")
} else {
ginkgo.By("Running test supported before gcsfuse v2.7.0")
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_ListAndDeleteDirectory", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
}
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(10), func() {
init()
defer cleanup()
v, err := version.ParseSemantic(GCSFuseVersionStr)
// If error != nil, this means we've autogenerated a tag (meaning we run from HEAD)
// Otherise, we have a valid tag, and we compare against the supported release.
if err != nil || v.AtLeast(version.MustParseSemantic("2.7.0-gke.0")) {
ginkgo.By("Running test supported for gcsfuse v2.7.0+")
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheDeleteDirTest/TestKernelListCache_DeleteAndListDirectory", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1", "metadata-cache-ttl-secs=0")
} else {
ginkgo.By("Running test supported before gcsfuse v2.7.0-gke.0")
gcsfuseIntegrationTest(testNameKernelListCache+":TestInfiniteKernelListCacheTest/TestKernelListCache_DeleteAndListDirectory", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=-1")
}
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(11), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestFiniteKernelListCacheTest/TestKernelListCache_CacheHitWithinLimit_CacheMissAfterLimit", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=5")
})
ginkgo.It(testNamePrefixSucceed+testNameKernelListCache+testNameSuffix(12), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameKernelListCache+":TestDisabledKernelListCacheTest/TestKernelListCache_AlwaysCacheMiss", false, "implicit-dirs=true", "kernel-list-cache-ttl-secs=0")
})
ginkgo.It(testNamePrefixSucceed+testNameManagedFolders+testNameSuffix(1), func() {
init()
defer cleanup()
gcsfuseIntegrationTest(testNameManagedFolders+":TestEnableEmptyManagedFoldersTrue", false, "implicit-dirs=true")
})
ginkgo.It(testNamePrefixSucceed+testNameEnableStreamingWrites+testNameSuffix(1), func() {
init()
defer cleanup()
if getClientProtocol(driver) == "grpc" {
e2eskipper.Skipf("skip gcsfuse integration grpc test %v with enable-streaming-writes", testNameEnableStreamingWrites)
} else {
gcsfuseIntegrationTest(testNameEnableStreamingWrites, false, "rename-dir-limit=3", "implicit-dirs=true", "enable-streaming-writes", "write-block-size-mb=1", "write-max-blocks-per-file=2", "write-global-max-blocks=-1")
}
})
ginkgo.It(testNamePrefixSucceed+testNameInactiveStreamTimeout+testNameSuffix(1), func() {
init()
defer cleanup()
mountOptions := []string{"read-inactive-stream-timeout=0s", "logging:format:json", fmt.Sprintf("logging:file-path:%s", inactive_stream_timeout_log_file), "log-severity=trace"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameInactiveStreamTimeout+":TestTimeoutDisabledSuite", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameInactiveStreamTimeout+testNameSuffix(2), func() {
init()
defer cleanup()
mountOptions := []string{"read-inactive-stream-timeout=1s", "logging:format:json", fmt.Sprintf("logging:file-path:%s", inactive_stream_timeout_log_file), "log-severity=trace"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameInactiveStreamTimeout+":TestTimeoutEnabledSuite/TestReaderCloses", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameInactiveStreamTimeout+testNameSuffix(3), func() {
init()
defer cleanup()
mountOptions := []string{"read-inactive-stream-timeout=1s", "logging:format:json", fmt.Sprintf("logging:file-path:%s", inactive_stream_timeout_log_file), "log-severity=trace"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameInactiveStreamTimeout+":TestTimeoutEnabledSuite/TestReaderStaysOpenWithinTimeout", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameBufferedReads+testNameSuffix(1), func() {
init()
defer cleanup()
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"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameBufferedReads+":TestSequentialReadSuite", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameBufferedReads+testNameSuffix(2), func() {
init()
defer cleanup()
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"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameBufferedReads+":TestFallbackSuites/TestRandomRead_LargeFile_Fallback", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameBufferedReads+testNameSuffix(3), func() {
init()
defer cleanup()
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"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameBufferedReads+":TestFallbackSuites/TestRandomRead_SmallFile_NoFallback", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameBufferedReads+testNameSuffix(4), func() {
init()
defer cleanup()
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"}
if isKernelParamSupported() {
mountOptions = append(mountOptions, "file-system:enable-kernel-reader:false")
}
gcsfuseIntegrationTest(testNameBufferedReads+":TestFallbackSuites/TestNewBufferedReader_InsufficientGlobalPool_NoReaderAdded", false, mountOptions...)
})
ginkgo.It(testNamePrefixSucceed+testNameRenameSymlink+testNameSuffix(1), func() {
init()
defer cleanup()
if getClientProtocol(driver) == "grpc" {
e2eskipper.Skipf("skip gcsfuse integration grpc test %v with rename-symlink", testNameRenameSymlink)
} else {
gcsfuseIntegrationTest(testNameRenameSymlink, false, "implicit-dirs=true", "metadata-cache-negative-ttl-secs=0")
}
})
}