content: query active downloads and status

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2016-11-15 20:29:43 -08:00
parent b6e446e7be
commit 9dea9654bd
No known key found for this signature in database
GPG key ID: FB5F6B2905D7ECF3
2 changed files with 72 additions and 1 deletions

View file

@ -10,6 +10,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"reflect"
"testing"
"github.com/docker/distribution/digest"
@ -54,6 +55,21 @@ func TestContentWriter(t *testing.T) {
t.Fatal("no error on second resume")
}
// we should also see this as an active ingestion
ingestions, err := cs.Active()
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(ingestions, []Status{
{
Ref: "myref",
Size: 0,
},
}) {
t.Fatalf("unexpected ingestion set: %v", ingestions)
}
p := make([]byte, 4<<20)
if _, err := rand.Read(p); err != nil {
t.Fatal(err)