Pārlūkot izejas kodu

Merge pull request #32636 from aaronlehmann/example-dot-com

Avoid using "example.com" in integration test
Vincent Demeester 8 gadi atpakaļ
vecāks
revīzija
a35a65b78a
1 mainītis faili ar 7 papildinājumiem un 3 dzēšanām
  1. 7 3
      integration-cli/docker_api_images_test.go

+ 7 - 3
integration-cli/docker_api_images_test.go

@@ -3,6 +3,7 @@ package main
 import (
 	"encoding/json"
 	"net/http"
+	"net/http/httptest"
 	"net/url"
 	"strings"
 
@@ -120,13 +121,16 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
 func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
 	testRequires(c, Network)
 
+	server := httptest.NewServer(http.NewServeMux())
+	defer server.Close()
+
 	tt := []struct {
 		statusExp int
 		fromSrc   string
 	}{
-		{http.StatusNotFound, "http://example.com/nofile.tar"},
-		{http.StatusNotFound, "example.com/nofile.tar"},
-		{http.StatusNotFound, "example.com%2Fdata%2Ffile.tar"},
+		{http.StatusNotFound, server.URL + "/nofile.tar"},
+		{http.StatusNotFound, strings.TrimPrefix(server.URL, "http://") + "/nofile.tar"},
+		{http.StatusNotFound, strings.TrimPrefix(server.URL, "http://") + "%2Fdata%2Ffile.tar"},
 		{http.StatusInternalServerError, "%2Fdata%2Ffile.tar"},
 	}