Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using PATH env variable instead of copying gcsfuse package for integration tests #1877

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions tools/integration_tests/run_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,6 @@ function main(){
echo "The e2e tests for hns bucket failed.."
exit 1
fi

# Removing bin file after testing.
if [ $RUN_E2E_TESTS_ON_PACKAGE != true ];
then
sudo rm /usr/local/bin/gcsfuse
fi
}

#Main method to run script
Expand Down
19 changes: 5 additions & 14 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"
"testing"
Expand All @@ -43,6 +44,7 @@ const (
FilePermission_0600 = 0600
DirPermission_0755 = 0755
Charset = "abcdefghijklmnopqrstuvwxyz0123456789"
PathEnvVariable = "PATH"
)

var (
Expand Down Expand Up @@ -162,10 +164,10 @@ func SetUpTestDir() error {

// 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")
// 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("Error in copying bin file:%v", err)
log.Printf("Error in setting PATH environment variable: %v", err.Error())
}
} else {
// when testInstalledPackage flag is set, gcsfuse is preinstalled on the
Expand All @@ -183,17 +185,6 @@ func SetUpTestDir() error {
return nil
}

// Removing bin file after testing.
func RemoveBinFileCopiedForTesting() {
if !TestInstalledPackage() {
cmd := exec.Command("sudo", "rm", "/usr/local/bin/gcsfuse")
err := cmd.Run()
if err != nil {
log.Printf("Error in removing file:%v", err)
}
}
}

func UnMount() error {
fusermount, err := exec.LookPath("fusermount")
if err != nil {
Expand Down
Loading