Skip to content

Commit

Permalink
Fix size test to run only for S3, cleanup tests for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jfantinhardesty committed Jan 23, 2025
1 parent d6c332c commit 98710e2
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ jobs:
sleep 10
ps -aux | grep cloudfuse
cd test/e2e_tests
go test -v -timeout=7200s ./... -args -mnt-path=${{ env.MOUNT_DIR }} -tmp-path=${{ env.TEMP_DIR }}
go test -v -timeout=7200s ./... -args -mnt-path=${{ env.MOUNT_DIR }} -tmp-path=${{ env.TEMP_DIR }} -s3storage=true
cd -
sudo fusermount -u ${{ env.MOUNT_DIR }}
sleep 5
Expand Down Expand Up @@ -293,7 +293,7 @@ jobs:
sleep 10
ps -aux | grep cloudfuse
cd test/e2e_tests
go test -v -timeout=7200s ./... -args -mnt-path=${{ env.MOUNT_DIR }} -tmp-path=${{ env.TEMP_DIR }}
go test -v -timeout=7200s ./... -args -mnt-path=${{ env.MOUNT_DIR }} -tmp-path=${{ env.TEMP_DIR }} -s3storage=true
cd -
sudo fusermount -u ${{ env.MOUNT_DIR }}
sleep 5
Expand Down
7 changes: 1 addition & 6 deletions component/size_tracker/size_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type SizeTrackerOptions struct {

const compName = "size_tracker"
const blockSize = int64(4096)
const emptyDirSize = uint64(4096)

Check failure on line 58 in component/size_tracker/size_tracker.go

View workflow job for this annotation

GitHub Actions / Lint

const `emptyDirSize` is unused (unused)
const default_journal_name = "mount_size.dat"

// Verification to check satisfaction criteria with Component Interface
Expand Down Expand Up @@ -118,12 +119,6 @@ func (st *SizeTracker) Priority() internal.ComponentPriority {
func (st *SizeTracker) OnConfigChange() {
}

// Directory operations
func (st *SizeTracker) DeleteDir(options internal.DeleteDirOptions) error {
// Libfuse only allows deleting empty directories, so we should not need to update the size here
return st.NextComponent().DeleteDir(options)
}

func (st *SizeTracker) RenameDir(options internal.RenameDirOptions) error {
// Rename dir should not allow renaming files into a directory that already exists so we should not
// need to update the size here.
Expand Down
21 changes: 20 additions & 1 deletion component/size_tracker/size_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -198,10 +199,13 @@ func (suite *sizeTrackerTestSuite) TestCreateFile() {
// Default is to not create empty files on create file to support immutable storage.
path := generateFileName()
options := internal.CreateFileOptions{Name: path}
_, err := suite.sizeTracker.CreateFile(options)
h, err := suite.sizeTracker.CreateFile(options)
suite.assert.NoError(err)
suite.assert.EqualValues(0, suite.sizeTracker.mountSize.GetSize())

err = suite.sizeTracker.CloseFile(internal.CloseFileOptions{Handle: h})
suite.assert.NoError(err)

err = suite.sizeTracker.DeleteFile(internal.DeleteFileOptions{Name: path})
suite.assert.NoError(err)
}
Expand Down Expand Up @@ -277,6 +281,9 @@ func (suite *sizeTrackerTestSuite) TestWriteFileMultiple() {
suite.assert.NoError(err)
suite.assert.EqualValues(4*len(data), int(suite.sizeTracker.mountSize.GetSize()))

err = suite.sizeTracker.CloseFile(internal.CloseFileOptions{Handle: handle})
suite.assert.NoError(err)

err = suite.sizeTracker.DeleteFile(internal.DeleteFileOptions{Name: file})
suite.assert.NoError(err)
}
Expand Down Expand Up @@ -362,6 +369,10 @@ func (suite *sizeTrackerTestSuite) TestRenameFile() {
}

func (suite *sizeTrackerTestSuite) TestRenameOpenFile() {
if runtime.GOOS == "windows" {
fmt.Println("Skipping test on Windows")
return
}
defer suite.cleanupTest()

src := "src2"
Expand Down Expand Up @@ -393,6 +404,10 @@ func (suite *sizeTrackerTestSuite) TestRenameOpenFile() {
}

func (suite *sizeTrackerTestSuite) TestRenameWriteFile() {
if runtime.GOOS == "windows" {
fmt.Println("Skipping test on Windows")
return
}
defer suite.cleanupTest()

src := "src3"
Expand Down Expand Up @@ -473,6 +488,10 @@ func (suite *sizeTrackerTestSuite) TestTruncateFileOpen() {
}

func (suite *sizeTrackerTestSuite) TestSymlink() {
if runtime.GOOS == "windows" {
fmt.Println("Skipping test on Windows")
return
}
defer suite.cleanupTest()
// Setup
file := generateFileName()
Expand Down
Loading

0 comments on commit 98710e2

Please sign in to comment.