Skip to content

Commit

Permalink
set path environment variable instead of copying gcsfuse bin file
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed Apr 30, 2024
1 parent 556547d commit 8520f5c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 10 additions & 8 deletions tools/integration_tests/operations/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
"github.com/googlecloudplatform/gcsfuse/v2/internal/config"
"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/creds_tests"
"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/mounting/dynamic_mounting"
"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/mounting/only_dir_mounting"
"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/mounting/persistent_mounting"
"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/mounting/static_mounting"
"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/setup"
)

Expand Down Expand Up @@ -147,15 +149,15 @@ func TestMain(m *testing.M) {
mountConfigFlags := createMountConfigsAndEquivalentFlags()
flagsSet = append(flagsSet, mountConfigFlags...)

//successCode := static_mounting.RunTests(flagsSet, m)
//
//if successCode == 0 {
// successCode = only_dir_mounting.RunTests(flagsSet, m)
//}
successCode := static_mounting.RunTests(flagsSet, m)

//if successCode == 0 {
successCode := persistent_mounting.RunTests(flagsSet, m)
//}
if successCode == 0 {
successCode = only_dir_mounting.RunTests(flagsSet, m)
}

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

if successCode == 0 {
successCode = dynamic_mounting.RunTests(flagsSet, m)
Expand Down
16 changes: 7 additions & 9 deletions tools/integration_tests/util/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"os/exec"
"path"
"path/filepath"
"runtime/debug"
"strings"
"syscall"
Expand All @@ -44,6 +45,7 @@ const (
FilePermission_0600 = 0600
DirPermission_0755 = 0755
Charset = "abcdefghijklmnopqrstuvwxyz0123456789"
PathEnvVariable = "PATH"
)

var (
Expand Down Expand Up @@ -181,16 +183,12 @@ func SetUpTestDir() error {
binFile = path.Join(TestDir(), "bin/gcsfuse")
sbinFile = path.Join(TestDir(), "sbin/mount.gcsfuse")

//// mount.gcsfuse will find gcsfuse executable in mentioned locations.
//// https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/tools/mount_gcsfuse/find.go#L59
//// Copying the executable to /usr/local/bin
//err := operations.CopyDirWithRootPermission(binFile, "/usr/local/bin")
//if err != nil {
// log.Printf("Error in copying bin file:%v", err)
//}
err := os.Setenv("PATH", TestDir()+"/bin:"+os.Getenv("PATH"))
// mount.gcsfuse will find gcsfuse executable in mentioned locations.
// https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/tools/mount_gcsfuse/find.go#L59
// Setting PATH so that executable is found in test directory.
err := os.Setenv(PathEnvVariable, path.Join(TestDir(), "bin")+string(filepath.ListSeparator)+os.Getenv(PathEnvVariable))
if err != nil {
log.Printf(err.Error())
log.Printf("Error in setting PATH environment variable: %v", err.Error())
}
} else {
// when testInstalledPackage flag is set, gcsfuse is preinstalled on the
Expand Down

0 comments on commit 8520f5c

Please sign in to comment.