From 5daa9260bcef2a47c493adc04e6638c9d200a9cf Mon Sep 17 00:00:00 2001 From: Srini Brahmaroutu Date: Fri, 27 Feb 2015 22:18:11 +0000 Subject: [PATCH] Test image api through local V1 repo Closes #10967 Signed-off-by: Srini Brahmaroutu --- integration-cli/docker_cli_pull_test.go | 2 ++ integration-cli/requirements.go | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/integration-cli/docker_cli_pull_test.go b/integration-cli/docker_cli_pull_test.go index c55bd2e673..fec9700e2e 100644 --- a/integration-cli/docker_cli_pull_test.go +++ b/integration-cli/docker_cli_pull_test.go @@ -108,6 +108,8 @@ func TestPullNonExistingImage(t *testing.T) { // pulling an image from the central registry using official names should work // ensure all pulls result in the same image func TestPullImageOfficialNames(t *testing.T) { + testRequires(t, Network) + names := []string{ "docker.io/hello-world", "index.docker.io/hello-world", diff --git a/integration-cli/requirements.go b/integration-cli/requirements.go index 346d0cdf66..cdd9991873 100644 --- a/integration-cli/requirements.go +++ b/integration-cli/requirements.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "log" + "net/http" "os/exec" "strings" "testing" @@ -32,6 +33,16 @@ var ( func() bool { return supportsExec }, "Test requires 'docker exec' capabilities on the tested daemon.", } + Network = TestRequirement{ + func() bool { + resp, err := http.Get("http://hub.docker.com") + if resp != nil { + resp.Body.Close() + } + return err == nil + }, + "Test requires network availability, environment variable set to none to run in a non-network enabled mode.", + } RegistryHosting = TestRequirement{ func() bool { // for now registry binary is built only if we're running inside