This commit is contained in:
shin- 2013-07-31 19:12:40 +02:00
parent 4d9dcc3cba
commit 7c3b31e5d4

View File

@ -5,6 +5,7 @@ import (
"strings" "strings"
"testing" "testing"
) )
var ( var (
IMAGE_ID = "42d718c941f5c532ac049bf0b0ab53f0062f09a03afd4aa4a02c098e46032b9d" IMAGE_ID = "42d718c941f5c532ac049bf0b0ab53f0062f09a03afd4aa4a02c098e46032b9d"
TOKEN = []string{"fake-token"} TOKEN = []string{"fake-token"}
@ -52,7 +53,7 @@ func TestGetRemoteHistory(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
assertEqual(t, len(hist), 2, "Expected 2 images in history") assertEqual(t, len(hist), 2, "Expected 2 images in history")
assertEqual(t, hist[0], IMAGE_ID, "Expected " + IMAGE_ID + "as first ancestry") assertEqual(t, hist[0], IMAGE_ID, "Expected "+IMAGE_ID+"as first ancestry")
assertEqual(t, hist[1], "77dbf71da1d00e3fbddc480176eac8994025630c6590d11cfc8fe1209c2a1d20", assertEqual(t, hist[1], "77dbf71da1d00e3fbddc480176eac8994025630c6590d11cfc8fe1209c2a1d20",
"Unexpected second ancestry") "Unexpected second ancestry")
} }
@ -105,7 +106,7 @@ func TestGetRemoteTags(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
assertEqual(t, len(tags), 1, "Expected one tag") assertEqual(t, len(tags), 1, "Expected one tag")
assertEqual(t, tags["latest"], IMAGE_ID, "Expected tag latest to map to " + IMAGE_ID) assertEqual(t, tags["latest"], IMAGE_ID, "Expected tag latest to map to "+IMAGE_ID)
_, err = r.GetRemoteTags([]string{makeURL("/v1/")}, "foo42/baz", TOKEN) _, err = r.GetRemoteTags([]string{makeURL("/v1/")}, "foo42/baz", TOKEN)
if err == nil { if err == nil {
@ -130,7 +131,7 @@ func TestPushImageJSONRegistry(t *testing.T) {
Checksum: "sha256:1ac330d56e05eef6d438586545ceff7550d3bdcb6b19961f12c5ba714ee1bb37", Checksum: "sha256:1ac330d56e05eef6d438586545ceff7550d3bdcb6b19961f12c5ba714ee1bb37",
} }
err := r.PushImageJSONRegistry(imgData, []byte{ 0x42, 0xdf, 0x0 }, makeURL("/v1/"), TOKEN) err := r.PushImageJSONRegistry(imgData, []byte{0x42, 0xdf, 0x0}, makeURL("/v1/"), TOKEN)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -157,7 +158,7 @@ func TestResolveRepositoryName(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
assertEqual(t, ep, "http://" + u + "/v1/", "Expected endpoint to be " + u) assertEqual(t, ep, "http://"+u+"/v1/", "Expected endpoint to be "+u)
assertEqual(t, repo, "private/moonbase", "Expected endpoint to be private/moonbase") assertEqual(t, repo, "private/moonbase", "Expected endpoint to be private/moonbase")
} }