Skip to content

Commit dbc1879

Browse files
committed
add function to check os env flag before test start
1 parent 6c60a98 commit dbc1879

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

internal/xtest/test_condition.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package xtest
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
// enableAllTestsFlag set the env var for run all tests
9+
// some of them may take a lot ot time (hours) or use functions
10+
// not published to common test docker image
11+
const enableAllTestsFlag = "YDB_GO_SDK_ENABLE_ALL_TESTS"
12+
13+
func AllowByFlag(t testing.TB, flag string) {
14+
if os.Getenv(flag) != "" {
15+
return
16+
}
17+
if os.Getenv(enableAllTestsFlag) != "" {
18+
return
19+
}
20+
t.Skipf("Skip test, because it need flag to run: '%v'", flag)
21+
}

table/table_e2e_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ func (s *stats) removeFromInFlight(t testing.TB, id string) {
172172
}
173173

174174
func TestTableMultiple(t *testing.T) {
175-
if _, ok := os.LookupEnv("LOCAL_TESTING"); !ok {
176-
t.Skip("only for local testing")
177-
}
175+
xtest.AllowByFlag(t, "HUGE_TEST")
178176
xtest.TestManyTimes(t, func(t testing.TB) {
179177
testTable(t)
180178
}, xtest.StopAfter(time.Hour))

0 commit comments

Comments
 (0)