mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
Revert all but TestPullImageFromCentralRegistry changes
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
@@ -96,33 +96,6 @@ func TestPullImageFromCentralRegistry(t *testing.T) {
|
||||
logDone("pull - pull hello-world")
|
||||
}
|
||||
|
||||
// pulling an image from the local registry should work
|
||||
func TestPullImageFromlocalRegistry(t *testing.T) {
|
||||
defer deleteAllContainers()
|
||||
|
||||
if err := startRegistryV1(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
repoName := privateV1RegistryURL
|
||||
defer deleteImages(repoName)
|
||||
|
||||
repo := fmt.Sprintf("%v/%v:%v", repoName, "busybox", "latest")
|
||||
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "tag", "busybox", repo)); err != nil {
|
||||
t.Fatalf("Failed to tag image %v: error %v, output %q", repo, err, out)
|
||||
}
|
||||
defer deleteImages(repo)
|
||||
|
||||
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "push", repo)); err != nil {
|
||||
t.Fatalf("Failed to push image %v: error %v, output %q", repo, err, string(out))
|
||||
}
|
||||
|
||||
pullCmd := exec.Command(dockerBinary, "pull", repo)
|
||||
if out, _, err := runCommandWithOutput(pullCmd); err != nil {
|
||||
t.Fatalf("pulling the hello-world image from the registry has failed: %s, %v", out, err)
|
||||
}
|
||||
logDone("pull - pull local hello-world")
|
||||
}
|
||||
|
||||
// pulling a non-existing image from the central registry should return a non-zero exit code
|
||||
func TestPullNonExistingImage(t *testing.T) {
|
||||
pullCmd := exec.Command(dockerBinary, "pull", "fooblahblah1234")
|
||||
|
||||
@@ -14,8 +14,7 @@ var (
|
||||
registryImageName = "registry"
|
||||
|
||||
// the private registry to use for tests
|
||||
privateRegistryURL = "127.0.0.1:5000"
|
||||
privateV1RegistryURL = "0.0.0.0:5000"
|
||||
privateRegistryURL = "127.0.0.1:5000"
|
||||
|
||||
dockerBasePath = "/var/lib/docker"
|
||||
execDriverPath = dockerBasePath + "/execdriver/native"
|
||||
|
||||
@@ -7,9 +7,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
const v2binary = "registry-v2"
|
||||
@@ -71,48 +69,3 @@ func (r *testRegistryV2) Close() {
|
||||
r.cmd.Process.Kill()
|
||||
os.RemoveAll(r.dir)
|
||||
}
|
||||
|
||||
func pingV1(ip string) error {
|
||||
// We always ping through HTTP for our test registry.
|
||||
resp, err := http.Get(fmt.Sprintf("http://%s/v1/search", ip))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
return fmt.Errorf("registry ping replied with an unexpected status code %d", resp.StatusCode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func startRegistryV1() error {
|
||||
//wait for registry image to be available
|
||||
for i := 0; i < 10; i++ {
|
||||
imagesCmd := exec.Command(dockerBinary, "images")
|
||||
out, _, err := runCommandWithOutput(imagesCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.Contains(out, "registry") {
|
||||
break
|
||||
}
|
||||
time.Sleep(60000 * time.Millisecond)
|
||||
if i == 10 {
|
||||
fmt.Errorf("No registry image is found to start the regictry V1 services")
|
||||
}
|
||||
}
|
||||
|
||||
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "--name", "regserver", "-d", "-p", "5000:5000", "registry", "docker-registry")); err != nil {
|
||||
fmt.Errorf("Failed to start registry: error %v, output %q", err, out)
|
||||
}
|
||||
ip := privateV1RegistryURL
|
||||
//wait until registry server is available
|
||||
for i := 0; i < 10; i++ {
|
||||
if err := pingV1(ip); err == nil {
|
||||
return nil
|
||||
} else if i == 10 && err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user