本文整理匯總了Golang中github.com/cloudfoundry-incubator/lattice/ltc/droplet_runner.DropletRunner.ListDroplets方法的典型用法代碼示例。如果您正苦於以下問題:Golang DropletRunner.ListDroplets方法的具體用法?Golang DropletRunner.ListDroplets怎麽用?Golang DropletRunner.ListDroplets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/lattice/ltc/droplet_runner.DropletRunner
的用法示例。
在下文中一共展示了DropletRunner.ListDroplets方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
fakeProxyConfReader = &fake_proxyconf_reader.FakeProxyConfReader{}
dropletRunner = droplet_runner.New(fakeAppRunner, fakeTaskRunner, config, fakeBlobStore, fakeAppExaminer, fakeProxyConfReader)
})
Describe("ListDroplets", func() {
It("returns a list of droplets in the blob store", func() {
fakeBlobStore.ListReturns([]blob.Blob{
{Path: "X/bits.zip", Created: time.Unix(1000, 0), Size: 100},
{Path: "X/droplet.tgz", Created: time.Unix(2000, 0), Size: 200},
{Path: "X/result.json", Created: time.Unix(3000, 0), Size: 300},
{Path: "Y/bits.zip"},
{Path: "X/Y/droplet.tgz"},
{Path: "droplet.tgz"},
}, nil)
Expect(dropletRunner.ListDroplets()).To(Equal([]droplet_runner.Droplet{
{Name: "X", Created: time.Unix(2000, 0), Size: 200},
}))
})
It("returns an error when querying the blob store fails", func() {
fakeBlobStore.ListReturns(nil, errors.New("some error"))
_, err := dropletRunner.ListDroplets()
Expect(err).To(MatchError("some error"))
})
})
Describe("UploadBits", func() {
Context("when the archive path is a file and exists", func() {
var tmpFile *os.File
示例2:
case "Z/":
return &s3.ListResp{
Name: "bucket-name",
Prefix: "Z/",
Delimiter: "/",
Contents: []s3.Key{
s3.Key{Key: "Z/bits.tgz"},
},
}, nil
}
Fail("no stub for arguments: " + prefix + "," + delim + "," + marker + "," + string(max))
return nil, nil
}
droplets, err := dropletRunner.ListDroplets()
Expect(err).NotTo(HaveOccurred())
Expect(len(droplets)).To(Equal(2))
Expect(droplets[0].Name).To(Equal("X"))
Expect(droplets[0].Created.Unix()).To(Equal(time.Date(2006, 1, 2, 15, 4, 5, 999, time.UTC).Unix()))
Expect(droplets[0].Size).To(Equal(int64(200)))
Expect(droplets[1].Name).To(Equal("Y"))
Expect(droplets[1].Created).To(BeZero())
Expect(droplets[1].Size).To(Equal(int64(0)))
})
It("returns an error when querying the blob store fails", func() {
config.SetBlobTarget("blob-host", 7474, "access-key", "secret-key", "bucket-name")
config.Save()