コード例 #1
0
ファイル: storage.go プロジェクト: roberto/docker-cluster
func testRetrieveContainers(storage cluster.Storage, t *testing.T) {
	defer storage.RemoveContainer("container-1")
	defer storage.RemoveContainer("container-2")
	defer storage.RemoveContainer("container-3")
	err := storage.StoreContainer("container-1", "host-1")
	assertIsNil(err, t)
	err = storage.StoreContainer("container-2", "host-1")
	assertIsNil(err, t)
	err = storage.StoreContainer("container-3", "host-2")
	assertIsNil(err, t)
	containers, err := storage.RetrieveContainers()
	assertIsNil(err, t)
	if len(containers) != 3 {
		t.Errorf("Unexpected len %d - expected %d", len(containers), 3)
	}
}