소스 검색

Test image api through local V1 repo

Closes #10967
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Srini Brahmaroutu 10 년 전
부모
커밋
5daa9260bc
2개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      integration-cli/docker_cli_pull_test.go
  2. 11 0
      integration-cli/requirements.go

+ 2 - 0
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",

+ 11 - 0
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