当前位置: 首页>>代码示例>>Golang>>正文


Golang DropletRunner.ListDroplets方法代码示例

本文整理汇总了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
开发者ID:datachand,项目名称:lattice,代码行数:31,代码来源:droplet_runner_test.go

示例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()
开发者ID:thomasdarimont,项目名称:lattice,代码行数:30,代码来源:droplet_runner_test.go


注:本文中的github.com/cloudfoundry-incubator/lattice/ltc/droplet_runner.DropletRunner.ListDroplets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。