Skip to content

Commit b937cf5

Browse files
committed
added CLI specific test
1 parent b6f4db6 commit b937cf5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

pkg/sidecar_mounter/sidecar_mounter_config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ func (mc *MountConfig) prepareMountArgs() {
206206
for _, arg := range mc.Options {
207207
klog.Infof("processing mount arg %v", arg)
208208

209-
if strings.Contains(arg, ":") && !strings.Contains(arg, "https") {
209+
// Config file flags are identified by not containing '=' and containing ':'.
210+
// e.g., "logging:severity:error"
211+
if !strings.Contains(arg, "=") && strings.Contains(arg, ":") && !strings.Contains(arg, "https") {
210212
var f, v string
211213
if strings.HasPrefix(arg, "gcs-connection:custom-endpoint:") {
212214
parts := strings.SplitN(arg, ":", 3)

pkg/sidecar_mounter/sidecar_mounter_config_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,26 @@ func TestPrepareMountArgs(t *testing.T) {
318318
"gcs-connection:custom-endpoint": "custom-service.my-system.svc.cluster.local:8080",
319319
},
320320
},
321+
{
322+
name: "should correctly parse custom-endpoint with a port in CLI format",
323+
mc: &MountConfig{
324+
BucketName: "test-bucket",
325+
BufferDir: "test-buffer-dir",
326+
CacheDir: "test-cache-dir",
327+
ConfigFile: "test-config-file",
328+
Options: []string{"custom-endpoint=custom-service.my-system.svc.cluster.local:8080"},
329+
},
330+
expectedArgs: map[string]string{
331+
"app-name": GCSFuseAppName,
332+
"temp-dir": "test-buffer-dir/temp-dir",
333+
"config-file": "test-config-file",
334+
"foreground": "",
335+
"uid": "0",
336+
"gid": "0",
337+
"custom-endpoint": "custom-service.my-system.svc.cluster.local:8080",
338+
},
339+
expectedConfigMapArgs: defaultConfigFileFlagMap,
340+
},
321341
}
322342

323343
testPrometheusPort := prometheusPort

0 commit comments

Comments
 (0)