Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed Jan 7, 2025
1 parent bfb75b2 commit afea12b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions cmd/config_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"time"

"github.com/googlecloudplatform/gcsfuse/v2/cfg"
"github.com/googlecloudplatform/gcsfuse/v2/internal/util"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -190,7 +191,7 @@ func TestValidateConfigFile_WriteConfig(t *testing.T) {
expectedConfig: &cfg.Config{
Write: cfg.WriteConfig{
CreateEmptyFile: false,
BlockSizeMb: 64,
BlockSizeMb: 64 * util.MiB,
ExperimentalEnableStreamingWrites: false,
GlobalMaxBlocks: math.MaxInt64,
MaxBlocksPerFile: math.MaxInt64},
Expand All @@ -202,7 +203,7 @@ func TestValidateConfigFile_WriteConfig(t *testing.T) {
expectedConfig: &cfg.Config{
Write: cfg.WriteConfig{
CreateEmptyFile: false, // changed due to enabled streaming writes.
BlockSizeMb: 10,
BlockSizeMb: 10 * util.MiB,
ExperimentalEnableStreamingWrites: true,
GlobalMaxBlocks: 20,
MaxBlocksPerFile: 2,
Expand Down
17 changes: 9 additions & 8 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"time"

"github.com/googlecloudplatform/gcsfuse/v2/cfg"
"github.com/googlecloudplatform/gcsfuse/v2/internal/util"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -207,7 +208,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--create-empty-file=true", "abc", "pqr"},
expectedCreateEmptyFile: true,
expectedEnableStreamingWrites: false,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -216,7 +217,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--create-empty-file=false", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: false,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -225,7 +226,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: false,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -234,7 +235,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--experimental-enable-streaming-writes", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: true,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -243,7 +244,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--experimental-enable-streaming-writes=false", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: false,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -252,7 +253,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--experimental-enable-streaming-writes", "--write-block-size-mb=10", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: true,
expectedWriteBlockSizeMB: 10,
expectedWriteBlockSizeMB: 10 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -261,7 +262,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--experimental-enable-streaming-writes", "--write-global-max-blocks=10", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: true,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: 10,
expectedWriteMaxBlocksPerFile: math.MaxInt64,
},
Expand All @@ -270,7 +271,7 @@ func TestArgsParsing_WriteConfigFlags(t *testing.T) {
args: []string{"gcsfuse", "--experimental-enable-streaming-writes", "--write-max-blocks-per-file=10", "abc", "pqr"},
expectedCreateEmptyFile: false,
expectedEnableStreamingWrites: true,
expectedWriteBlockSizeMB: 64,
expectedWriteBlockSizeMB: 64 * util.MiB,
expectedWriteGlobalMaxBlocks: math.MaxInt64,
expectedWriteMaxBlocksPerFile: 10,
},
Expand Down

0 comments on commit afea12b

Please sign in to comment.