Skip to content

Commit 4d152a0

Browse files
committed
gemini code reviews
1 parent 7318778 commit 4d152a0

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

tools/integration_tests/buffered_read/fallback_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type RandomReadFallbackSuite struct {
8282
// the BufferedReader is not created, and reads fall back to the next reader
8383
// without any buffered reading.
8484
func (s *InsufficientPoolCreationSuite) TestNewBufferedReader_InsufficientGlobalPool_NoReaderAdded() {
85-
fileSize := int64(3 * 8 * util.MiB)
85+
fileSize := blockSizeInBytes * 3
8686
chunkSize := int64(1 * util.MiB)
8787
testDir := setup.SetupTestDirectory(testDirName)
8888
fileName := setupFileInTestDir(testEnv.ctx, testEnv.storageClient, testDir, fileSize, s.T())
@@ -103,7 +103,6 @@ func (s *InsufficientPoolCreationSuite) TestNewBufferedReader_InsufficientGlobal
103103

104104
func (s *RandomReadFallbackSuite) TestRandomRead_Fallback() {
105105
const randomReadsThreshold = 3
106-
blockSizeInBytes := int64(8 * util.MiB)
107106
// Create a file with 4 blocks. We will read backwards from block 3 to 0
108107
// to trigger random seek detection.
109108
numBlocks := 4
@@ -125,7 +124,6 @@ func (s *RandomReadFallbackSuite) TestRandomRead_Fallback() {
125124
}
126125

127126
func (s *RandomReadFallbackSuite) TestRandomRead_SmallFile_NoFallback() {
128-
blockSizeInBytes := int64(8 * util.MiB)
129127
// File size is small, less than one block.
130128
fileSize := blockSizeInBytes / 2
131129
chunkSize := int64(1 * util.KiB)

tools/integration_tests/buffered_read/sequential_read_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func (s *SequentialReadSuite) TearDownSuite() {
6161
// Test Cases
6262
// //////////////////////////////////////////////////////////////////////
6363
func (s *SequentialReadSuite) TestSequentialRead() {
64-
blockSizeInBytes := int64(8 * util.MiB)
6564
fileSizeTests := []struct {
6665
name string
6766
fileSize int64
@@ -105,8 +104,6 @@ func (s *SequentialReadSuite) TestSequentialRead() {
105104
// The key validation is that all these operations should be served from a single
106105
// buffered read log entry, indicating efficient handling.
107106
func (s *SequentialReadSuite) TestReadHeaderFooterAndBody() {
108-
// Constants for block and file sizes
109-
blockSizeInBytes := int64(8 * util.MiB)
110107
// Header and footer sizes (10KB each)
111108
headerSize := 10 * util.KiB
112109
footerSize := 10 * util.KiB
@@ -154,7 +151,6 @@ func (s *SequentialReadSuite) TestReadHeaderFooterAndBody() {
154151
// TestReadSpanningTwoBlocks verifies that a read spanning two buffer blocks is
155152
// handled correctly.
156153
func (s *SequentialReadSuite) TestReadSpanningTwoBlocks() {
157-
blockSizeInBytes := int64(8 * util.MiB)
158154
// Ensure file is large enough for multi-block reads.
159155
fileSize := 3 * blockSizeInBytes
160156
// We want to read 512KB, with 256KB in the first block and 256KB in the second.

tools/integration_tests/buffered_read/setup_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"testing"
2323

2424
"cloud.google.com/go/storage"
25+
"github.com/googlecloudplatform/gcsfuse/v3/internal/util"
2526
"github.com/googlecloudplatform/gcsfuse/v3/tools/integration_tests/util/client"
2627
"github.com/googlecloudplatform/gcsfuse/v3/tools/integration_tests/util/mounting/static_mounting"
2728
"github.com/googlecloudplatform/gcsfuse/v3/tools/integration_tests/util/setup"
@@ -32,14 +33,12 @@ const (
3233
testDirName = "BufferedReadTest"
3334
testFileName = "foo"
3435
logFileNameForMountedDirectoryTests = "/tmp/gcsfuse_buffered_read_test_logs/log.json"
36+
// Global block size constant for tests
37+
blockSizeInBytes = int64(8 * util.MiB)
3538
)
3639

3740
var (
3841
mountFunc func(*test_suite.TestConfig, []string) error
39-
// mount directory is where our tests run.
40-
mountDir string
41-
// root directory is the directory to be unmounted.
42-
rootDir string
4342
)
4443

4544
type env struct {
@@ -114,16 +113,12 @@ func TestMain(m *testing.M) {
114113

115114
// 3. To run mountedDirectory tests, we need both testBucket and mountedDirectory
116115
if testEnv.cfg.GKEMountedDirectory != "" && testEnv.cfg.TestBucket != "" {
117-
// Save mount and root directory variables.
118-
mountDir, rootDir = testEnv.cfg.GKEMountedDirectory, testEnv.cfg.GKEMountedDirectory
119116
os.Exit(setup.RunTestsForMountedDirectory(testEnv.cfg.GKEMountedDirectory, m))
120117
}
121118

122119
// Run tests for testBucket
123120
// Set up test directory.
124121
setup.SetUpTestDirForTestBucket(testEnv.cfg)
125-
// Save mount and root directory variables.
126-
mountDir, rootDir = testEnv.cfg.GCSFuseMountedDirectory, testEnv.cfg.GCSFuseMountedDirectory
127122

128123
mountFunc = static_mounting.MountGcsfuseWithStaticMountingWithConfigFile
129124

0 commit comments

Comments
 (0)