Merge pull request #32636 from aaronlehmann/example-dot-com
Avoid using "example.com" in integration test
This commit is contained in:
commit
a35a65b78a
1 changed files with 7 additions and 3 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -120,13 +121,16 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
|
||||||
func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
|
func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
|
||||||
testRequires(c, Network)
|
testRequires(c, Network)
|
||||||
|
|
||||||
|
server := httptest.NewServer(http.NewServeMux())
|
||||||
|
defer server.Close()
|
||||||
|
|
||||||
tt := []struct {
|
tt := []struct {
|
||||||
statusExp int
|
statusExp int
|
||||||
fromSrc string
|
fromSrc string
|
||||||
}{
|
}{
|
||||||
{http.StatusNotFound, "http://example.com/nofile.tar"},
|
{http.StatusNotFound, server.URL + "/nofile.tar"},
|
||||||
{http.StatusNotFound, "example.com/nofile.tar"},
|
{http.StatusNotFound, strings.TrimPrefix(server.URL, "http://") + "/nofile.tar"},
|
||||||
{http.StatusNotFound, "example.com%2Fdata%2Ffile.tar"},
|
{http.StatusNotFound, strings.TrimPrefix(server.URL, "http://") + "%2Fdata%2Ffile.tar"},
|
||||||
{http.StatusInternalServerError, "%2Fdata%2Ffile.tar"},
|
{http.StatusInternalServerError, "%2Fdata%2Ffile.tar"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue