Port client to use URLBuilder to create urls
This change ports the client use the URLBuilder to create urls. Without this, it produces broken urls for certain use cases. The client has also been updated to no longer use the size argument to complete blob uploads. Much of this work has been done after testing with the staging registry instance.
This commit is contained in:
parent
a4f42b8eea
commit
fc7b47cdae
2 changed files with 75 additions and 38 deletions
|
@ -24,11 +24,11 @@ func TestPush(t *testing.T) {
|
|||
tag := "sometag"
|
||||
testBlobs := []testBlob{
|
||||
{
|
||||
digest: "12345",
|
||||
digest: "tarsum.v2+sha256:12345",
|
||||
contents: []byte("some contents"),
|
||||
},
|
||||
{
|
||||
digest: "98765",
|
||||
digest: "tarsum.v2+sha256:98765",
|
||||
contents: []byte("some other contents"),
|
||||
},
|
||||
}
|
||||
|
@ -80,7 +80,6 @@ func TestPush(t *testing.T) {
|
|||
Method: "PUT",
|
||||
Route: uploadLocations[i],
|
||||
QueryParams: map[string][]string{
|
||||
"length": {fmt.Sprint(len(blob.contents))},
|
||||
"digest": {blob.digest.String()},
|
||||
},
|
||||
Body: blob.contents,
|
||||
|
@ -114,7 +113,10 @@ func TestPush(t *testing.T) {
|
|||
})
|
||||
|
||||
server = httptest.NewServer(hack)
|
||||
client := New(server.URL)
|
||||
client, err := New(server.URL)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating client: %v", err)
|
||||
}
|
||||
objectStore := &memoryObjectStore{
|
||||
mutex: new(sync.Mutex),
|
||||
manifestStorage: make(map[string]*storage.SignedManifest),
|
||||
|
@ -150,11 +152,11 @@ func TestPull(t *testing.T) {
|
|||
tag := "sometag"
|
||||
testBlobs := []testBlob{
|
||||
{
|
||||
digest: "12345",
|
||||
digest: "tarsum.v2+sha256:12345",
|
||||
contents: []byte("some contents"),
|
||||
},
|
||||
{
|
||||
digest: "98765",
|
||||
digest: "tarsum.v2+sha256:98765",
|
||||
contents: []byte("some other contents"),
|
||||
},
|
||||
}
|
||||
|
@ -205,7 +207,10 @@ func TestPull(t *testing.T) {
|
|||
},
|
||||
}))
|
||||
server := httptest.NewServer(handler)
|
||||
client := New(server.URL)
|
||||
client, err := New(server.URL)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating client: %v", err)
|
||||
}
|
||||
objectStore := &memoryObjectStore{
|
||||
mutex: new(sync.Mutex),
|
||||
manifestStorage: make(map[string]*storage.SignedManifest),
|
||||
|
@ -259,11 +264,11 @@ func TestPullResume(t *testing.T) {
|
|||
tag := "sometag"
|
||||
testBlobs := []testBlob{
|
||||
{
|
||||
digest: "12345",
|
||||
digest: "tarsum.v2+sha256:12345",
|
||||
contents: []byte("some contents"),
|
||||
},
|
||||
{
|
||||
digest: "98765",
|
||||
digest: "tarsum.v2+sha256:98765",
|
||||
contents: []byte("some other contents"),
|
||||
},
|
||||
}
|
||||
|
@ -329,7 +334,10 @@ func TestPullResume(t *testing.T) {
|
|||
|
||||
handler := testutil.NewHandler(layerRequestResponseMappings)
|
||||
server := httptest.NewServer(handler)
|
||||
client := New(server.URL)
|
||||
client, err := New(server.URL)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating client: %v", err)
|
||||
}
|
||||
objectStore := &memoryObjectStore{
|
||||
mutex: new(sync.Mutex),
|
||||
manifestStorage: make(map[string]*storage.SignedManifest),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue