2014-08-08 06:58:58 +00:00
|
|
|
package graph
|
|
|
|
|
2014-11-11 13:02:14 +02:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2015-08-25 14:17:42 -07:00
|
|
|
"github.com/docker/docker/pkg/progressreader"
|
2014-11-11 13:02:14 +02:00
|
|
|
"github.com/docker/docker/pkg/reexec"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
reexec.Init()
|
|
|
|
}
|
2014-08-08 06:58:58 +00:00
|
|
|
|
|
|
|
func TestPools(t *testing.T) {
|
|
|
|
s := &TagStore{
|
2015-08-11 10:12:47 -07:00
|
|
|
pullingPool: make(map[string]*progressreader.Broadcaster),
|
|
|
|
pushingPool: make(map[string]*progressreader.Broadcaster),
|
2014-08-08 06:58:58 +00:00
|
|
|
}
|
|
|
|
|
2015-08-11 09:44:50 -07:00
|
|
|
if _, found := s.poolAdd("pull", "test1"); found {
|
|
|
|
t.Fatal("Expected pull test1 not to be in progress")
|
2014-08-08 06:58:58 +00:00
|
|
|
}
|
2015-08-11 09:44:50 -07:00
|
|
|
if _, found := s.poolAdd("pull", "test2"); found {
|
|
|
|
t.Fatal("Expected pull test2 not to be in progress")
|
2014-08-08 06:58:58 +00:00
|
|
|
}
|
2015-08-11 09:44:50 -07:00
|
|
|
if _, found := s.poolAdd("push", "test1"); !found {
|
|
|
|
t.Fatalf("Expected pull test1 to be in progress`")
|
2014-08-08 06:58:58 +00:00
|
|
|
}
|
2015-08-11 09:44:50 -07:00
|
|
|
if _, found := s.poolAdd("pull", "test1"); !found {
|
|
|
|
t.Fatalf("Expected pull test1 to be in progress`")
|
2014-08-08 06:58:58 +00:00
|
|
|
}
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|