Browse code

Skip all testdata in integration

Also skip.IfCondition directly from the test, so that the skip message is correct

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2017/10/03 06:02:52
Showing 4 changed files
... ...
@@ -15,7 +15,7 @@ source "$SCRIPTDIR/make/.go-autogen"
15 15
 
16 16
 integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
17 17
 	find ./integration -type d |
18
-	grep -vE '^(./integration($|/util|/testdata|/plugin$))')"}
18
+	grep -vE '(^./integration($|/util)|/testdata)')"}
19 19
 
20 20
 run_test_integration() {
21 21
 	[[ "$TESTFLAGS" != *-check.f* ]] && run_test_integration_suites
... ...
@@ -31,7 +31,7 @@ var (
31 31
 
32 32
 func setupTestV2(t *testing.T) func() {
33 33
 	skip.IfCondition(t, testEnv.DaemonInfo.OSType != "linux")
34
-	requirement.HasHubConnectivity(t)
34
+	skip.IfCondition(t, !requirement.HasHubConnectivity(t))
35 35
 
36 36
 	teardown := setupTest(t)
37 37
 
38 38
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+package plugin
... ...
@@ -5,21 +5,16 @@ import (
5 5
 	"strings"
6 6
 	"testing"
7 7
 	"time"
8
-
9
-	"github.com/gotestyourself/gotestyourself/skip"
10 8
 )
11 9
 
12 10
 // HasHubConnectivity checks to see if https://hub.docker.com is
13 11
 // accessible from the present environment
14
-func HasHubConnectivity(t *testing.T) {
12
+func HasHubConnectivity(t *testing.T) bool {
15 13
 	// Set a timeout on the GET at 15s
16 14
 	var timeout = 15 * time.Second
17 15
 	var url = "https://hub.docker.com"
18 16
 
19
-	client := http.Client{
20
-		Timeout: timeout,
21
-	}
22
-
17
+	client := http.Client{Timeout: timeout}
23 18
 	resp, err := client.Get(url)
24 19
 	if err != nil && strings.Contains(err.Error(), "use of closed network connection") {
25 20
 		t.Fatalf("Timeout for GET request on %s", url)
... ...
@@ -27,5 +22,5 @@ func HasHubConnectivity(t *testing.T) {
27 27
 	if resp != nil {
28 28
 		resp.Body.Close()
29 29
 	}
30
-	skip.IfCondition(t, err != nil)
30
+	return err == nil
31 31
 }