Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed Jun 11, 2024
1 parent 3afce89 commit 01bd505
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 2 additions & 0 deletions cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// GENERATED CODE - DO NOT EDIT config.go FILE MANUALLY.

package cfg

import (
Expand Down
2 changes: 2 additions & 0 deletions tools/config-gen/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// GENERATED CODE - DO NOT EDIT config.go FILE MANUALLY.

package cfg

import (
Expand Down
2 changes: 1 addition & 1 deletion tools/mount_gcsfuse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func makeGcsfuseArgs(
"metadata_cache_ttl_secs",
"log_severity",
"log_rotate_max_file_size_mb",
"log_rotate_backup_file-count",
"log_rotate_backup_file_count",
"file_cache_max_size_mb",
"grpc_conn_pool_size":

Expand Down
21 changes: 11 additions & 10 deletions tools/mount_gcsfuse/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestMakeGcsfuseArgs(t *testing.T) {
mountPoint string
opts map[string]string
expected []string
expectErr bool
}{
{
name: "TestMakeGcsfuseArgs with NoOptions",
Expand Down Expand Up @@ -96,17 +95,23 @@ func TestMakeGcsfuseArgs(t *testing.T) {
device: "gcsfuse",
mountPoint: "/mnt/gcs",
opts: map[string]string{
"dir_mode": "0755", "key_file": "/path/to/key"},
expected: []string{"--dir-mode", "0755", "--key-file", "/path/to/key", "gcsfuse", "/mnt/gcs"},
"dir_mode": "0755",
"key_file": "/path/to/key",
"log_rotate_backup_file_count": "2",
},
expected: []string{"--dir-mode", "0755", "--key-file", "/path/to/key", "--log-rotate-backup-file-count", "2", "gcsfuse", "/mnt/gcs"},
},

{
name: "TestMakeGcsfuseArgs for StringFlags with hyphen",
device: "gcsfuse",
mountPoint: "/mnt/gcs",
opts: map[string]string{
"dir-mode": "0755", "key-file": "/path/to/key"},
expected: []string{"--dir-mode", "0755", "--key-file", "/path/to/key", "gcsfuse", "/mnt/gcs"},
"dir-mode": "0755",
"key-file": "/path/to/key",
"log-rotate-backup-file-count": "2",
},
expected: []string{"--dir-mode", "0755", "--key-file", "/path/to/key", "--log-rotate-backup-file-count", "2", "gcsfuse", "/mnt/gcs"},
},

{
Expand Down Expand Up @@ -148,11 +153,7 @@ func TestMakeGcsfuseArgs(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
args, err := makeGcsfuseArgs(tc.device, tc.mountPoint, tc.opts)
if tc.expectErr && err == nil {
t.Errorf("Expected error, but got none")
} else if !tc.expectErr && err != nil {
t.Errorf("Unexpected error: %v", err)
}
assert.Nil(t, err)

// Assert that all flags are present (no matter the order).
assert.ElementsMatch(t, args[:len(args)-2], tc.expected[:len(tc.expected)-2])
Expand Down

0 comments on commit 01bd505

Please sign in to comment.