Skip to content

Commit 260e73e

Browse files
committed
Improve addition of debug options in createVolumeResource by using mountpoint.Args
Signed-off-by: Renan Magagnin <renanmag@amazon.co.uk>
1 parent 730ed0a commit 260e73e

3 files changed

Lines changed: 14 additions & 15 deletions

File tree

pkg/mountpoint/args.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const (
2020
ArgGid = "--gid"
2121
ArgDirMode = "--dir-mode"
2222
ArgFileMode = "--file-mode"
23+
ArgDebug = "--debug"
24+
ArgDebugCRT = "--debug-crt"
2325
)
2426

2527
// An ArgKey represents the key of an argument.

tests/e2e-kubernetes/testsuites/mountoptions.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,30 +88,31 @@ func (t *s3CSIMountOptionsTestSuite) DefineTests(driver storageframework.TestDri
8888
"allow-other",
8989
})
9090
expectedMountOptions := []string{
91-
"allow-other",
92-
"debug",
93-
"debug-crt",
91+
"--allow-other",
92+
"--debug",
93+
"--debug-crt",
9494
}
9595
gomega.Expect(resource.Pv.Spec.MountOptions).To(gomega.Equal(expectedMountOptions))
9696

9797
resource = createVolumeResource(ctx, l.config, pattern, v1.ReadWriteMany, []string{
9898
"allow-other",
9999
"--debug",
100+
"--debug-crt",
100101
})
101102
expectedMountOptions = []string{
102-
"allow-other",
103+
"--allow-other",
103104
"--debug",
104-
"debug-crt",
105+
"--debug-crt",
105106
}
106107
gomega.Expect(resource.Pv.Spec.MountOptions).To(gomega.Equal(expectedMountOptions))
107108

108109
resource = createVolumeResource(ctx, l.config, pattern, v1.ReadWriteMany, []string{
109110
"allow-other",
110-
"--debug",
111-
"--debug-crt",
111+
"debug",
112+
"debug-crt",
112113
})
113114
expectedMountOptions = []string{
114-
"allow-other",
115+
"--allow-other",
115116
"--debug",
116117
"--debug-crt",
117118
}

tests/e2e-kubernetes/testsuites/util.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,8 @@ func createVolumeResource(ctx context.Context, config *storageframework.PerTestC
108108

109109
// Add debug options if they're not already present
110110
normalizedOptions := mountpoint.ParseArgs(mountOptions)
111-
debugOptions := []string{"debug", "debug-crt"}
112-
for _, option := range debugOptions {
113-
if !normalizedOptions.Has(option) {
114-
mountOptions = append(mountOptions, option)
115-
}
116-
}
111+
normalizedOptions.Set(mountpoint.ArgDebug, mountpoint.ArgNoValue)
112+
normalizedOptions.Set(mountpoint.ArgDebugCRT, mountpoint.ArgNoValue)
117113

118114
pv := &v1.PersistentVolume{
119115
ObjectMeta: metav1.ObjectMeta{
@@ -123,7 +119,7 @@ func createVolumeResource(ctx context.Context, config *storageframework.PerTestC
123119
PersistentVolumeSource: *pvSource,
124120
StorageClassName: "", // for static provisioning
125121
NodeAffinity: volumeNodeAffinity,
126-
MountOptions: mountOptions, // this is not set by storageframework.CreateVolumeResource, which is why we need to implement our own function
122+
MountOptions: normalizedOptions.SortedList(), // this is not set by storageframework.CreateVolumeResource, which is why we need to implement our own function
127123
AccessModes: []v1.PersistentVolumeAccessMode{accessMode},
128124
Capacity: v1.ResourceList{
129125
v1.ResourceStorage: resource.MustParse("1200Gi"),

0 commit comments

Comments
 (0)