Browse code

Tests for push to registry v2

Signed-off-by: Alexander Morozov <lk4d4@docker.com>

Alexander Morozov authored on 2015/01/13 07:30:19
Showing 1 changed files
... ...
@@ -10,29 +10,27 @@ import (
10 10
 
11 11
 // pulling an image from the central registry should work
12 12
 func TestPushBusyboxImage(t *testing.T) {
13
-	// skip this test until we're able to use a registry
14
-	t.Skip()
13
+	reg, err := newTestRegistryV2(t)
14
+	if err != nil {
15
+		t.Fatal(err)
16
+	}
17
+	defer reg.Close()
18
+	repoName := fmt.Sprintf("%v/dockercli/busybox", reg.URL)
15 19
 	// tag the image to upload it tot he private registry
16
-	repoName := fmt.Sprintf("%v/busybox", privateRegistryURL)
17 20
 	tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
18 21
 	if out, _, err := runCommandWithOutput(tagCmd); err != nil {
19 22
 		t.Fatalf("image tagging failed: %s, %v", out, err)
20 23
 	}
21
-
24
+	defer deleteImages(repoName)
22 25
 	pushCmd := exec.Command(dockerBinary, "push", repoName)
23 26
 	if out, _, err := runCommandWithOutput(pushCmd); err != nil {
24 27
 		t.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
25 28
 	}
26
-
27
-	deleteImages(repoName)
28
-
29 29
 	logDone("push - push busybox to private registry")
30 30
 }
31 31
 
32 32
 // pushing an image without a prefix should throw an error
33 33
 func TestPushUnprefixedRepo(t *testing.T) {
34
-	// skip this test until we're able to use a registry
35
-	t.Skip()
36 34
 	pushCmd := exec.Command(dockerBinary, "push", "busybox")
37 35
 	if out, _, err := runCommandWithOutput(pushCmd); err == nil {
38 36
 		t.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)