github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/xtest/test_condition.go (about)

     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  }