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


Golang PipelineDB.SaveResourceVersions方法代码示例

本文整理汇总了Golang中github.com/concourse/atc/db.PipelineDB.SaveResourceVersions方法的典型用法代码示例。如果您正苦于以下问题:Golang PipelineDB.SaveResourceVersions方法的具体用法?Golang PipelineDB.SaveResourceVersions怎么用?Golang PipelineDB.SaveResourceVersions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/concourse/atc/db.PipelineDB的用法示例。


在下文中一共展示了PipelineDB.SaveResourceVersions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

				versions = append(versions, version)
				expectedVersions = append(expectedVersions,
					db.SavedVersionedResource{
						ID:      i + 1,
						Enabled: true,
						VersionedResource: db.VersionedResource{
							Resource:     resource.Name,
							Type:         resource.Type,
							Version:      db.Version(version),
							Metadata:     nil,
							PipelineName: pipelineDB.GetPipelineName(),
						},
					})
			}

			err := pipelineDB.SaveResourceVersions(resource, versions)
			Expect(err).NotTo(HaveOccurred())
		})

		Context("when there are no versions to be found", func() {
			It("returns the versions, with previous/next pages", func() {
				historyPage, pagination, err := pipelineDB.GetResourceVersions("nope", db.Page{})
				Expect(err).ToNot(HaveOccurred())
				Expect(historyPage).To(Equal([]db.SavedVersionedResource{}))
				Expect(pagination).To(Equal(db.Pagination{}))
			})
		})

		Context("with no since/until", func() {
			It("returns the first page, with the given limit, and a next page", func() {
				historyPage, pagination, err := pipelineDB.GetResourceVersions("some-resource", db.Page{Limit: 2})
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:pipeline_db_resource_versions_test.go

示例2:

				pipelineDB, err = pipelineDBFactory.BuildDefault()
				Ω(err).ShouldNot(HaveOccurred())

				resourceConfig := atc.ResourceConfig{
					Name:   "resource-name",
					Type:   "some-type",
					Source: atc.Source{},
				}

				var resourceVersions []atc.Version
				for i := 0; i < 104; i++ {
					resourceVersions = append(resourceVersions, atc.Version{"version": strconv.Itoa(i)})
				}

				pipelineDB.SaveResourceVersions(resourceConfig, resourceVersions)
			})

			It("there is pagination", func() {
				// homepage -> resource detail
				Expect(page.Navigate(homepage())).To(Succeed())
				Eventually(page.FindByLink("resource-name")).Should(BeFound())
				Expect(page.FindByLink("resource-name").Click()).To(Succeed())

				// resource detail -> paused resource detail
				Expect(page).Should(HaveURL(withPath("/resources/resource-name")))
				Expect(page.Find("h1")).To(HaveText("resource-name"))
				Expect(page.All(".pagination").Count()).Should(Equal(2))
				Expect(page.Find(".resource-versions")).Should(BeFound())
				Expect(page.All(".resource-versions li").Count()).Should(Equal(100))
开发者ID:utako,项目名称:atc,代码行数:29,代码来源:resource_pagination_test.go


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