@@ -41,24 +41,20 @@ type fallbackSuiteBase struct {
4141}
4242
4343func (s * fallbackSuiteBase ) SetupSuite () {
44- if setup .MountedDirectory () != "" {
45- setupForMountedDirectoryTests ()
46- return
47- }
44+ setup .SetUpLogFilePath (s .flags , GKETempDir , "" , testEnv .cfg )
4845 setup .MountGCSFuseWithGivenMountWithConfigFunc (testEnv .cfg , s .flags , mountFunc )
46+ setup .SetMntDir (mountDir )
47+ }
48+
49+ func (s * fallbackSuiteBase ) TearDownSuite () {
50+ setup .UnmountGCSFuseWithConfig (testEnv .cfg )
4951}
5052
5153func (s * fallbackSuiteBase ) SetupTest () {
52- err := os .Truncate (setup .LogFile (), 0 )
53- require .NoError (s .T (), err , "Failed to truncate log file" )
54+ testEnv .testDirPath = setup .SetupTestDirectory (testDirName )
5455}
5556
56- func (s * fallbackSuiteBase ) TearDownSuite () {
57- if setup .MountedDirectory () != "" {
58- setup .SaveGCSFuseLogFileInCaseOfFailure (s .T ())
59- return
60- }
61- setup .UnmountGCSFuseWithConfig (testEnv .cfg )
57+ func (s * fallbackSuiteBase ) TearDownTest () {
6258 setup .SaveGCSFuseLogFileInCaseOfFailure (s .T ())
6359}
6460
@@ -82,6 +78,8 @@ type RandomReadFallbackSuite struct {
8278// the BufferedReader is not created, and reads fall back to the next reader
8379// without any buffered reading.
8480func (s * InsufficientPoolCreationSuite ) TestNewBufferedReader_InsufficientGlobalPool_NoReaderAdded () {
81+ err := os .Truncate (setup .LogFile (), 0 )
82+ require .NoError (s .T (), err , "Failed to truncate log file" )
8583 fileSize := blockSizeInBytes * 3
8684 chunkSize := int64 (1 * util .MiB )
8785 testDir := setup .SetupTestDirectory (testDirName )
@@ -102,6 +100,8 @@ func (s *InsufficientPoolCreationSuite) TestNewBufferedReader_InsufficientGlobal
102100}
103101
104102func (s * RandomReadFallbackSuite ) TestRandomRead_Fallback () {
103+ err := os .Truncate (setup .LogFile (), 0 )
104+ require .NoError (s .T (), err , "Failed to truncate log file" )
105105 const randomReadsThreshold = 3
106106 // Create a file with 4 blocks. We will read backwards from block 3 to 0
107107 // to trigger random seek detection.
@@ -124,6 +124,8 @@ func (s *RandomReadFallbackSuite) TestRandomRead_Fallback() {
124124}
125125
126126func (s * RandomReadFallbackSuite ) TestRandomRead_SmallFile_NoFallback () {
127+ err := os .Truncate (setup .LogFile (), 0 )
128+ require .NoError (s .T (), err , "Failed to truncate log file" )
127129 // File size is small, less than one block.
128130 fileSize := blockSizeInBytes / 2
129131 chunkSize := int64 (1 * util .KiB )
@@ -149,6 +151,8 @@ func (s *RandomReadFallbackSuite) TestRandomRead_SmallFile_NoFallback() {
149151// due to random reads, the buffered reader is re-engaged once the read pattern
150152// becomes sequential again.
151153func (s * RandomReadFallbackSuite ) TestRandomThenSequential_SwitchesBackToBufferedRead () {
154+ err := os .Truncate (setup .LogFile (), 0 )
155+ require .NoError (s .T (), err , "Failed to truncate log file" )
152156 fileSize := int64 (20 * util .MiB )
153157 testDir := setup .SetupTestDirectory (testDirName )
154158 fileName := setupFileInTestDir (testEnv .ctx , testEnv .storageClient , testDir , fileSize , s .T ())
0 commit comments