Skip to content

Commit

Permalink
Prevent unit test failure due to flag parse (#2764)
Browse files Browse the repository at this point in the history
* prevent unit test failure due to flag parse

* add return

* small fix
  • Loading branch information
Tulsishah authored Dec 10, 2024
1 parent 3ed9119 commit 9c10d53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/integration_tests/emulator_tests/proxy_server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net/http/httptest"
"testing"

"github.com/googlecloudplatform/gcsfuse/v2/tools/integration_tests/util/setup"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -49,3 +50,12 @@ func TestAddRetryID(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "test-id-123", req.Header.Get("x-retry-test-id"), "Unexpected x-retry-test-id header value")
}

func TestMain(m *testing.M) {
setup.ParseSetUpFlags()

// Skip running unit tests as part of the integration tests. Although running these tests will not cause any failures.
if setup.IsIntegrationTest() {
return
}
}
4 changes: 4 additions & 0 deletions tools/integration_tests/util/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func IsPresubmitRun() bool {
return *isPresubmitRun
}

func IsIntegrationTest() bool {
return *integrationTest
}

func TestBucket() string {
return *testBucket
}
Expand Down

0 comments on commit 9c10d53

Please sign in to comment.