mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Tests for push to registry v2
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
2fc2862a73
commit
f138f7bd50
1 changed files with 7 additions and 9 deletions
|
@ -10,29 +10,27 @@ import (
|
||||||
|
|
||||||
// pulling an image from the central registry should work
|
// pulling an image from the central registry should work
|
||||||
func TestPushBusyboxImage(t *testing.T) {
|
func TestPushBusyboxImage(t *testing.T) {
|
||||||
// skip this test until we're able to use a registry
|
reg, err := newTestRegistryV2(t)
|
||||||
t.Skip()
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer reg.Close()
|
||||||
|
repoName := fmt.Sprintf("%v/dockercli/busybox", reg.URL)
|
||||||
// tag the image to upload it tot he private registry
|
// tag the image to upload it tot he private registry
|
||||||
repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
|
|
||||||
tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
|
tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
|
||||||
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
|
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
|
||||||
t.Fatalf("image tagging failed: %s, %v", out, err)
|
t.Fatalf("image tagging failed: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
defer deleteImages(repoName)
|
||||||
pushCmd := exec.Command(dockerBinary, "push", repoName)
|
pushCmd := exec.Command(dockerBinary, "push", repoName)
|
||||||
if out, _, err := runCommandWithOutput(pushCmd); err != nil {
|
if out, _, err := runCommandWithOutput(pushCmd); err != nil {
|
||||||
t.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
|
t.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteImages(repoName)
|
|
||||||
|
|
||||||
logDone("push - push busybox to private registry")
|
logDone("push - push busybox to private registry")
|
||||||
}
|
}
|
||||||
|
|
||||||
// pushing an image without a prefix should throw an error
|
// pushing an image without a prefix should throw an error
|
||||||
func TestPushUnprefixedRepo(t *testing.T) {
|
func TestPushUnprefixedRepo(t *testing.T) {
|
||||||
// skip this test until we're able to use a registry
|
|
||||||
t.Skip()
|
|
||||||
pushCmd := exec.Command(dockerBinary, "push", "busybox")
|
pushCmd := exec.Command(dockerBinary, "push", "busybox")
|
||||||
if out, _, err := runCommandWithOutput(pushCmd); err == nil {
|
if out, _, err := runCommandWithOutput(pushCmd); err == nil {
|
||||||
t.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
t.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
||||||
|
|
Loading…
Reference in a new issue