2014-02-25 11:17:48 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
// these tests need a freshly started empty private docker registry
|
|
|
|
|
|
|
|
// pulling an image from the central registry should work
|
|
|
|
func TestPushBusyboxImage(t *testing.T) {
|
|
|
|
// skip this test until we're able to use a registry
|
|
|
|
t.Skip()
|
|
|
|
// tag the image to upload it tot he private registry
|
|
|
|
repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
|
|
|
|
tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
|
2014-10-14 17:02:15 -04:00
|
|
|
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
|
2014-11-05 11:26:22 -05:00
|
|
|
t.Fatalf("image tagging failed: %s, %v", out, err)
|
2014-02-25 11:17:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pushCmd := exec.Command(dockerBinary, "push", repoName)
|
2014-10-14 17:02:15 -04:00
|
|
|
if out, _, err := runCommandWithOutput(pushCmd); err != nil {
|
2014-11-05 11:26:22 -05:00
|
|
|
t.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
|
2014-10-14 17:02:15 -04:00
|
|
|
}
|
2014-02-25 11:17:48 -05:00
|
|
|
|
2014-04-03 20:22:32 -04:00
|
|
|
deleteImages(repoName)
|
2014-02-25 11:17:48 -05:00
|
|
|
|
|
|
|
logDone("push - push busybox to private registry")
|
|
|
|
}
|
|
|
|
|
|
|
|
// pushing an image without a prefix should throw an error
|
|
|
|
func TestPushUnprefixedRepo(t *testing.T) {
|
|
|
|
// skip this test until we're able to use a registry
|
|
|
|
t.Skip()
|
|
|
|
pushCmd := exec.Command(dockerBinary, "push", "busybox")
|
2014-10-14 17:02:15 -04:00
|
|
|
if out, _, err := runCommandWithOutput(pushCmd); err == nil {
|
2014-11-05 11:26:22 -05:00
|
|
|
t.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
2014-02-25 11:17:48 -05:00
|
|
|
}
|
|
|
|
logDone("push - push unprefixed busybox repo --> must fail")
|
|
|
|
}
|