當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Storage.RemoveContainer方法代碼示例

本文整理匯總了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")
	}
}
開發者ID:roberto,項目名稱:docker-cluster,代碼行數:26,代碼來源:storage.go

示例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)
	}
}
開發者ID:wdxxs2z,項目名稱:docker-cluster,代碼行數:10,代碼來源:storage.go

示例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)
	}
}
開發者ID:roberto,項目名稱:docker-cluster,代碼行數:16,代碼來源:storage.go


注:本文中的github.com/tsuru/docker-cluster/cluster.Storage.RemoveContainer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。