mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
2391233404
progressreader.Broadcaster becomes broadcaster.Buffered and broadcastwriter.Writer becomes broadcaster.Unbuffered. The package broadcastwriter is thus renamed to broadcaster. Signed-off-by: Tibor Vass <tibor@docker.com>
44 lines
1 KiB
Go
44 lines
1 KiB
Go
package graph
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/pkg/broadcaster"
|
|
"github.com/docker/docker/pkg/reexec"
|
|
)
|
|
|
|
func init() {
|
|
reexec.Init()
|
|
}
|
|
|
|
func TestPools(t *testing.T) {
|
|
s := &TagStore{
|
|
pullingPool: make(map[string]*broadcaster.Buffered),
|
|
pushingPool: make(map[string]*broadcaster.Buffered),
|
|
}
|
|
|
|
if _, found := s.poolAdd("pull", "test1"); found {
|
|
t.Fatal("Expected pull test1 not to be in progress")
|
|
}
|
|
if _, found := s.poolAdd("pull", "test2"); found {
|
|
t.Fatal("Expected pull test2 not to be in progress")
|
|
}
|
|
if _, found := s.poolAdd("push", "test1"); !found {
|
|
t.Fatalf("Expected pull test1 to be in progress`")
|
|
}
|
|
if _, found := s.poolAdd("pull", "test1"); !found {
|
|
t.Fatalf("Expected pull test1 to be in progress`")
|
|
}
|
|
if err := s.poolRemove("pull", "test2"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.poolRemove("pull", "test2"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.poolRemove("pull", "test1"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.poolRemove("push", "test1"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|