Skip to content

Commit

Permalink
Fixing integration tests (#1157)
Browse files Browse the repository at this point in the history
* small_fix_integration_test

* small_fix_integration_test

* Delete run_load_test_on_presubmit.sh

* add deleted file
  • Loading branch information
Tulsishah committed Jun 5, 2023
1 parent 5cd3ae9 commit 43d5ddc
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion perfmetrics/scripts/continuous_test/gcp_ubuntu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ commitId=$(git log --before='yesterday 23:59:59' --max-count=1 --pretty=%H)
git checkout $commitId

echo "Executing integration tests"
GODEBUG=asyncpreemptoff=1 go test ./tools/integration_tests/... -p 1 --integrationTest -v --testbucket=gcsfuse-integration-test -timeout=60m
GODEBUG=asyncpreemptoff=1 go test ./tools/integration_tests/... -p 1 --integrationTest -v --testbucket=gcsfuse-integration-test

# Checkout back to master branch to use latest CI test scripts in master.
git checkout master
Expand Down
2 changes: 1 addition & 1 deletion perfmetrics/scripts/presubmit_test/pr_perf_test/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ echo checkout PR branch
git checkout pr/$KOKORO_GITHUB_PULL_REQUEST_NUMBER

# Executing integration tests
GODEBUG=asyncpreemptoff=1 go test ./tools/integration_tests/... -p 1 --integrationTest -v --testbucket=gcsfuse-integration-test -timeout=60m
GODEBUG=asyncpreemptoff=1 go test ./tools/integration_tests/... -p 1 --integrationTest -v --testbucket=gcsfuse-integration-test

# Executing perf tests
echo Mounting gcs bucket from pr branch
Expand Down
4 changes: 3 additions & 1 deletion tools/integration_tests/operations/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ func TestMain(m *testing.M) {
setup.ExitWithFailureIfBothTestBucketAndMountedDirectoryFlagsAreNotSet()

if setup.TestBucket() != "" && setup.MountedDirectory() != "" {
log.Printf("Both --testbucket and --mountedDirectory can't be specified at the same time.")
log.Print("Both --testbucket and --mountedDirectory can't be specified at the same time.")
os.Exit(1)
}

// Run tests for mountedDirectory only if --mountedDirectory flag is set.
setup.RunTestsForMountedDirectoryFlag(m)

// Run tests for testBucket
setup.SetUpTestDirForTestBucketFlag()

successCode := static_mounting.RunTests(flags, m)

if successCode == 0 {
Expand Down
5 changes: 3 additions & 2 deletions tools/integration_tests/readonly/readonly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ func TestMain(m *testing.M) {
setup.ExitWithFailureIfBothTestBucketAndMountedDirectoryFlagsAreNotSet()

if setup.TestBucket() == "" && setup.MountedDirectory() != "" {
log.Printf("Please pass the name of bucket mounted at mountedDirectory to --testBucket flag.")
log.Print("Please pass the name of bucket mounted at mountedDirectory to --testBucket flag.")
os.Exit(1)
}

// Run tests for testBucket
// Clean the bucket for readonly testing.
setup.RunScriptForTestData("testdata/delete_objects.sh", setup.TestBucket())

Expand All @@ -75,6 +74,8 @@ func TestMain(m *testing.M) {
// Run tests for mountedDirectory only if --mountedDirectory flag is set.
setup.RunTestsForMountedDirectoryFlag(m)

// Run tests for testBucket
setup.SetUpTestDirForTestBucketFlag()
successCode := static_mounting.RunTests(flags, m)

// Delete objects from bucket after testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ func TestMain(m *testing.M) {
setup.ExitWithFailureIfBothTestBucketAndMountedDirectoryFlagsAreNotSet()

if setup.TestBucket() != "" && setup.MountedDirectory() != "" {
log.Printf("Both --testbucket and --mountedDirectory can't be specified at the same time.")
log.Print("Both --testbucket and --mountedDirectory can't be specified at the same time.")
os.Exit(1)
}

// Run tests for mountedDirectory only if --mountedDirectory flag is set.
setup.RunTestsForMountedDirectoryFlag(m)

// Run tests for testBucket
setup.SetUpTestDirForTestBucketFlag()

successCode := static_mounting.RunTests(flags, m)

if successCode == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ func mountGcsFuseForFlagsAndExecuteTests(flags [][]string, dir string, m *testin
}

func executeTestsForOnlyDirMounting(flags [][]string, m *testing.M) (successCode int) {
setup.SetUpTestDirForTestBucketFlag()

mountDirInBucket := path.Join(setup.TestBucket(), DirectoryInTestBucket)
// Clean the bucket.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func mountGcsfuseWithStaticMounting(flags []string) (err error) {
func executeTestsForStatingMounting(flags [][]string, m *testing.M) (successCode int) {
var err error

setup.SetUpTestDirForTestBucketFlag()

for i := 0; i < len(flags); i++ {
if err = mountGcsfuseWithStaticMounting(flags[i]); err != nil {
setup.LogAndExit(fmt.Sprintf("mountGcsfuse: %v\n", err))
Expand Down
4 changes: 2 additions & 2 deletions tools/integration_tests/util/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func ParseSetUpFlags() {
flag.Parse()

if !*integrationTest {
log.Printf("Pass --integrationTest flag to run the tests.")
log.Print("Pass --integrationTest flag to run the tests.")
os.Exit(0)
}
}
Expand All @@ -209,7 +209,7 @@ func ExitWithFailureIfBothTestBucketAndMountedDirectoryFlagsAreNotSet() {
ParseSetUpFlags()

if *testBucket == "" && *mountedDirectory == "" {
log.Printf("--testbucket or --mountedDirectory must be specified")
log.Print("--testbucket or --mountedDirectory must be specified")
os.Exit(1)
}
}
Expand Down

0 comments on commit 43d5ddc

Please sign in to comment.