1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Daniel Nephin 2017-10-02 17:02:52 -04:00
parent 1574d91463
commit 104c1c6843
4 changed files with 6 additions and 10 deletions

View file

@ -15,7 +15,7 @@ source "$SCRIPTDIR/make/.go-autogen"
integration_api_dirs=${TEST_INTEGRATION_DIR:-"$( integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
find ./integration -type d | find ./integration -type d |
grep -vE '^(./integration($|/util|/testdata|/plugin$))')"} grep -vE '(^./integration($|/util)|/testdata)')"}
run_test_integration() { run_test_integration() {
[[ "$TESTFLAGS" != *-check.f* ]] && run_test_integration_suites [[ "$TESTFLAGS" != *-check.f* ]] && run_test_integration_suites

View file

@ -31,7 +31,7 @@ var (
func setupTestV2(t *testing.T) func() { func setupTestV2(t *testing.T) func() {
skip.IfCondition(t, testEnv.DaemonInfo.OSType != "linux") skip.IfCondition(t, testEnv.DaemonInfo.OSType != "linux")
requirement.HasHubConnectivity(t) skip.IfCondition(t, !requirement.HasHubConnectivity(t))
teardown := setupTest(t) teardown := setupTest(t)

View file

@ -0,0 +1 @@
package plugin

View file

@ -5,21 +5,16 @@ import (
"strings" "strings"
"testing" "testing"
"time" "time"
"github.com/gotestyourself/gotestyourself/skip"
) )
// HasHubConnectivity checks to see if https://hub.docker.com is // HasHubConnectivity checks to see if https://hub.docker.com is
// accessible from the present environment // accessible from the present environment
func HasHubConnectivity(t *testing.T) { func HasHubConnectivity(t *testing.T) bool {
// Set a timeout on the GET at 15s // Set a timeout on the GET at 15s
var timeout = 15 * time.Second var timeout = 15 * time.Second
var url = "https://hub.docker.com" var url = "https://hub.docker.com"
client := http.Client{ client := http.Client{Timeout: timeout}
Timeout: timeout,
}
resp, err := client.Get(url) resp, err := client.Get(url)
if err != nil && strings.Contains(err.Error(), "use of closed network connection") { if err != nil && strings.Contains(err.Error(), "use of closed network connection") {
t.Fatalf("Timeout for GET request on %s", url) t.Fatalf("Timeout for GET request on %s", url)
@ -27,5 +22,5 @@ func HasHubConnectivity(t *testing.T) {
if resp != nil { if resp != nil {
resp.Body.Close() resp.Body.Close()
} }
skip.IfCondition(t, err != nil) return err == nil
} }