9 // SkipRemoteTestsEnvVar is an environment variable that can be set by a user
10 // running the tests in an environment with limited network connectivity. By
11 // default, tests requiring internet connectivity make an effort to skip if no
12 // internet is available, but in some cases the smoke test will pass even
13 // though the test should still be skipped.
14 const SkipRemoteTestsEnvVar = "TF_SKIP_REMOTE_TESTS"
16 // RemoteTestPrecheck is meant to be run by any unit test that requires
17 // outbound internet connectivity. The test will be skipped if it's
19 func RemoteTestPrecheck(t *testing.T) {
20 if os.Getenv(SkipRemoteTestsEnvVar) != "" {
21 t.Skipf("skipping test, %s was set", SkipRemoteTestsEnvVar)
24 if _, err := http.Get("http://google.com"); err != nil {
25 t.Skipf("skipping, internet seems to not be available: %s", err)