本文整理匯總了Golang中github.com/tsuru/docker-cluster/cluster.Storage.RemoveContainer方法的典型用法代碼示例。如果您正苦於以下問題:Golang Storage.RemoveContainer方法的具體用法?Golang Storage.RemoveContainer怎麽用?Golang Storage.RemoveContainer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tsuru/docker-cluster/cluster.Storage
的用法示例。
在下文中一共展示了Storage.RemoveContainer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testStorageStoreRetrieveContainer
func testStorageStoreRetrieveContainer(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)
host, err := storage.RetrieveContainer("container-1")
assertIsNil(err, t)
if host != "host-1" {
t.Errorf("Unexpected hostname %s - expected %s", host, "host-1")
}
host, err = storage.RetrieveContainer("container-2")
assertIsNil(err, t)
if host != "host-1" {
t.Errorf("Unexpected hostname %s - expected %s", host, "host-1")
}
host, err = storage.RetrieveContainer("container-3")
assertIsNil(err, t)
if host != "host-2" {
t.Errorf("Unexpected hostname %s - expected %s", host, "host-2")
}
}
示例2: testStorageStoreRemoveContainer
func testStorageStoreRemoveContainer(storage cluster.Storage, t *testing.T) {
err := storage.StoreContainer("container-1", "host-9")
assertIsNil(err, t)
err = storage.RemoveContainer("container-1")
assertIsNil(err, t)
_, err = storage.RetrieveContainer("container-1")
if err != cstorage.ErrNoSuchContainer {
t.Errorf("Error should be cstorage.ErrNoSuchContainer, received: %s", err)
}
}
示例3: testRetrieveContainers
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)
}
}