Skip to content

Commit

Permalink
Fix only dir mounting e2e test (#1880)
Browse files Browse the repository at this point in the history
* only dir test fix

* Update tools/integration_tests/local_file/local_file_test.go

Co-authored-by: Ashmeen Kaur <57195160+ashmeenkaur@users.noreply.github.com>

* review comments

* small changes

* small fix

---------

Co-authored-by: Ashmeen Kaur <57195160+ashmeenkaur@users.noreply.github.com>
  • Loading branch information
Tulsishah and ashmeenkaur authored May 3, 2024
1 parent c7baf1a commit 9313e1c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions tools/integration_tests/local_file/local_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import (
)

const (
testDirName = "LocalFileTest"
testDirName = "LocalFileTest"
onlyDirMounted = "OnlyDirMountLocalFiles"
)

var (
Expand Down Expand Up @@ -109,7 +110,7 @@ func TestMain(m *testing.M) {
successCode := static_mounting.RunTests(flagsSet, m)

if successCode == 0 {
successCode = only_dir_mounting.RunTests(flagsSet, m)
successCode = only_dir_mounting.RunTests(flagsSet, onlyDirMounted, m)
}

if successCode == 0 {
Expand Down
3 changes: 2 additions & 1 deletion tools/integration_tests/operations/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const PrefixFileInDirThreeInCreateThreeLevelDirTest = "fileInDirThreeInCreateThr
const FileInDirThreeInCreateThreeLevelDirTest = "fileInDirThreeInCreateThreeLevelDirTest1"
const ContentInFileInDirThreeInCreateThreeLevelDirTest = "Hello world!!"
const Content = "line 1\nline 2\n"
const onlyDirMounted = "OnlyDirMountOperations"

func createMountConfigsAndEquivalentFlags() (flags [][]string) {
cacheDirPath := path.Join(os.Getenv("HOME"), "cache-dri")
Expand Down Expand Up @@ -154,7 +155,7 @@ func TestMain(m *testing.M) {
successCode := static_mounting.RunTests(flagsSet, m)

if successCode == 0 {
successCode = only_dir_mounting.RunTests(flagsSet, m)
successCode = only_dir_mounting.RunTests(flagsSet, onlyDirMounted, m)
}

if successCode == 0 {
Expand Down
2 changes: 1 addition & 1 deletion tools/integration_tests/read_cache/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

const (
testDirName = "ReadCacheTest"
onlyDirMounted = "Test"
onlyDirMounted = "OnlyDirMountReadCache"
cacheSubDirectoryName = "gcsfuse-file-cache"
smallContentSize = 128 * util.KiB
chunkSizeToRead = 128 * util.KiB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const EmptySubDirectory = "emptySubDirectory"
const NonEmptySubDirectory = "nonEmptySubDirectory"
const RenamedDirectory = "renamedDirectory"
const PrefixTempFile = "temp"
const onlyDirMounted = "OnlyDirMountRenameDirLimit"

func TestMain(m *testing.M) {
setup.ParseSetUpFlags()
Expand All @@ -58,7 +59,7 @@ func TestMain(m *testing.M) {
successCode := static_mounting.RunTests(flags, m)

if successCode == 0 {
successCode = only_dir_mounting.RunTests(flags, m)
successCode = only_dir_mounting.RunTests(flags, onlyDirMounted, m)
}

if successCode == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ func mountGcsFuseForFlagsAndExecuteTests(flags [][]string, m *testing.M) (succes
return
}

func executeTestsForOnlyDirMounting(flags [][]string, m *testing.M) (successCode int) {
func executeTestsForOnlyDirMounting(flags [][]string, dirName string, m *testing.M) (successCode int) {
// Set onlyDirMounted value to the directory being mounted.
setup.SetOnlyDirMounted(DirectoryInTestBucket)
mountDirInBucket := path.Join(setup.TestBucket(), DirectoryInTestBucket)
setup.SetOnlyDirMounted(dirName)
mountDirInBucket := path.Join(setup.TestBucket(), dirName)
// Clean the bucket.

setup.RunScriptForTestData("../util/mounting/only_dir_mounting/testdata/delete_objects.sh", mountDirInBucket)
Expand All @@ -84,10 +84,10 @@ func executeTestsForOnlyDirMounting(flags [][]string, m *testing.M) (successCode
return
}

func RunTests(flags [][]string, m *testing.M) (successCode int) {
func RunTests(flags [][]string, dirName string, m *testing.M) (successCode int) {
log.Println("Running only dir mounting tests...")

successCode = executeTestsForOnlyDirMounting(flags, m)
successCode = executeTestsForOnlyDirMounting(flags, dirName, m)

log.Printf("Test log: %s\n", setup.LogFile())

Expand Down

0 comments on commit 9313e1c

Please sign in to comment.