github.com/titanous/docker@v1.4.1/integration-cli/docker_cli_push_test.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os/exec"
     6  	"testing"
     7  )
     8  
     9  // these tests need a freshly started empty private docker registry
    10  
    11  // pulling an image from the central registry should work
    12  func TestPushBusyboxImage(t *testing.T) {
    13  	// skip this test until we're able to use a registry
    14  	t.Skip()
    15  	// tag the image to upload it tot he private registry
    16  	repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
    17  	tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
    18  	if out, _, err := runCommandWithOutput(tagCmd); err != nil {
    19  		t.Fatalf("image tagging failed: %s, %v", out, err)
    20  	}
    21  
    22  	pushCmd := exec.Command(dockerBinary, "push", repoName)
    23  	if out, _, err := runCommandWithOutput(pushCmd); err != nil {
    24  		t.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
    25  	}
    26  
    27  	deleteImages(repoName)
    28  
    29  	logDone("push - push busybox to private registry")
    30  }
    31  
    32  // pushing an image without a prefix should throw an error
    33  func TestPushUnprefixedRepo(t *testing.T) {
    34  	// skip this test until we're able to use a registry
    35  	t.Skip()
    36  	pushCmd := exec.Command(dockerBinary, "push", "busybox")
    37  	if out, _, err := runCommandWithOutput(pushCmd); err == nil {
    38  		t.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
    39  	}
    40  	logDone("push - push unprefixed busybox repo --> must fail")
    41  }