• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang db.ConfigVersion函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

		secondBuildLink := ".table-row:nth-of-type(2) a"
		homeLink := ".js-groups li:nth-of-type(2) a"

		Context("with a one off build", func() {
			var oneOffBuild db.Build
			var build db.Build

			BeforeEach(func() {
				location := event.OriginLocation{ID: 1, ParentID: 0, ParallelGroup: 0}

				// job build data
				_, err := sqlDB.SaveConfig(atc.DefaultPipelineName, atc.Config{
					Jobs: []atc.JobConfig{
						{Name: "job-name"},
					},
				}, db.ConfigVersion(1), db.PipelineUnpaused)
				Expect(err).NotTo(HaveOccurred())

				pipelineDB, err = pipelineDBFactory.BuildWithName(atc.DefaultPipelineName)
				Expect(err).NotTo(HaveOccurred())

				build, err = pipelineDB.CreateJobBuild("job-name")
				Expect(err).NotTo(HaveOccurred())

				_, err = sqlDB.StartBuild(build.ID, "", "")
				Expect(err).NotTo(HaveOccurred())

				sqlDB.SaveBuildEvent(build.ID, event.Log{
					Origin: event.Origin{
						Name:     "origin-name",
						Type:     event.OriginTypeTask,
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:builds_list_test.go


示例2:

	"github.com/concourse/atc/web/group"

	. "github.com/concourse/atc/web/getjob"
	"github.com/concourse/atc/web/getjob/fakes"
)

var _ = Describe("FetchTemplateData", func() {
	var fakeDB *fakes.FakeJobDB

	BeforeEach(func() {
		fakeDB = new(fakes.FakeJobDB)
	})

	Context("when the config database returns an error", func() {
		BeforeEach(func() {
			fakeDB.GetConfigReturns(atc.Config{}, db.ConfigVersion(1), errors.New("disaster"))
		})

		It("returns an error if the config could not be loaded", func() {
			_, err := FetchTemplateData(fakeDB, "job-name")
			Ω(err).Should(HaveOccurred())
		})
	})

	Context("when the config database returns a config", func() {
		var job atc.JobConfig

		BeforeEach(func() {
			job = atc.JobConfig{
				Name: "job-name",
			}
开发者ID:utako,项目名称:atc,代码行数:31,代码来源:handler_test.go


示例3:

							Expect(err).NotTo(HaveOccurred())

							request.Body = gbytes.BufferWithBytes(payload)
						})

						It("returns 204", func() {
							Expect(response.StatusCode).To(Equal(http.StatusNoContent))
						})

						It("saves it", func() {
							Expect(configDB.SaveConfigCallCount()).To(Equal(1))

							name, savedConfig, id, pipelineState := configDB.SaveConfigArgsForCall(0)
							Expect(name).To(Equal("a-pipeline"))
							Expect(savedConfig).To(Equal(config))
							Expect(id).To(Equal(db.ConfigVersion(42)))
							Expect(pipelineState).To(Equal(db.PipelineNoChange))
						})

						Context("and saving it fails", func() {
							BeforeEach(func() {
								configDB.SaveConfigReturns(false, errors.New("oh no!"))
							})

							It("returns 500", func() {
								Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
							})

							It("returns the error in the response body", func() {
								Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("failed to save config: oh no!")))
							})
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:config_test.go


示例4:

)

var _ = Describe("Auth", func() {
	var atcProcess ifrit.Process
	var dbListener *pq.Listener
	var atcPort uint16

	BeforeEach(func() {
		logger := lagertest.NewTestLogger("test")
		postgresRunner.CreateTestDB()
		dbConn = postgresRunner.Open()
		dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
		bus := db.NewNotificationsBus(dbListener)
		sqlDB = db.NewSQL(logger, dbConn, bus)

		_, err := sqlDB.SaveConfig(atc.DefaultPipelineName, atc.Config{}, db.ConfigVersion(1), db.PipelineUnpaused)
		Ω(err).ShouldNot(HaveOccurred())

		atcBin, err := gexec.Build("github.com/concourse/atc/cmd/atc")
		Ω(err).ShouldNot(HaveOccurred())

		atcPort = 5697 + uint16(GinkgoParallelNode())
		debugPort := 6697 + uint16(GinkgoParallelNode())

		atcCommand := exec.Command(
			atcBin,
			"-webListenPort", fmt.Sprintf("%d", atcPort),
			"-debugListenPort", fmt.Sprintf("%d", debugPort),
			"-httpUsername", "admin",
			"-httpPassword", "password",
			"-templates", filepath.Join("..", "web", "templates"),
开发者ID:utako,项目名称:atc,代码行数:31,代码来源:auth_test.go


示例5:

							Ω(err).ShouldNot(HaveOccurred())

							request.Body = gbytes.BufferWithBytes(payload)
						})

						It("returns 200", func() {
							Ω(response.StatusCode).Should(Equal(http.StatusOK))
						})

						It("saves it", func() {
							Ω(configDB.SaveConfigCallCount()).Should(Equal(1))

							name, config, id, pipelineState := configDB.SaveConfigArgsForCall(0)
							Ω(name).Should(Equal("a-pipeline"))
							Ω(config).Should(Equal(config))
							Ω(id).Should(Equal(db.ConfigVersion(42)))
							Ω(pipelineState).Should(Equal(db.PipelineNoChange))
						})

						Context("and saving it fails", func() {
							BeforeEach(func() {
								configDB.SaveConfigReturns(false, errors.New("oh no!"))
							})

							It("returns 500", func() {
								Ω(response.StatusCode).Should(Equal(http.StatusInternalServerError))
							})

							It("returns the error in the response body", func() {
								Ω(ioutil.ReadAll(response.Body)).Should(Equal([]byte("failed to save config: oh no!")))
							})
开发者ID:utako,项目名称:atc,代码行数:31,代码来源:config_test.go


示例6:

	var dbSharedBehaviorInput = dbSharedBehaviorInput{}

	BeforeEach(func() {
		var err error

		postgresRunner.Truncate()

		dbConn = postgresRunner.Open()
		listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)

		Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
		bus := db.NewNotificationsBus(listener, dbConn)

		sqlDB = db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)

		sqlDB.SaveConfig("some-pipeline", atc.Config{}, db.ConfigVersion(1), db.PipelineUnpaused)
		pipelineDBFactory = db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, sqlDB)

		pipelineDB, err = pipelineDBFactory.BuildWithName("some-pipeline")
		Expect(err).NotTo(HaveOccurred())

		dbSharedBehaviorInput.DB = sqlDB
		dbSharedBehaviorInput.PipelineDB = pipelineDB
	})

	AfterEach(func() {
		err := dbConn.Close()
		Expect(err).NotTo(HaveOccurred())

		err = listener.Close()
		Expect(err).NotTo(HaveOccurred())
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:sqldb_test.go


示例7:

		bus := db.NewNotificationsBus(listener, dbConn)

		sqlDB := db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)
		database = sqlDB

		pipelineDBFactory := db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, sqlDB)
		_, err := database.SaveTeam(db.Team{Name: "some-team"})
		Expect(err).NotTo(HaveOccurred())
		config := atc.Config{
			Jobs: atc.JobConfigs{
				{
					Name: "some-job",
				},
			},
		}
		sqlDB.SaveConfig("some-team", "some-pipeline", config, db.ConfigVersion(1), db.PipelineUnpaused)
		pipelineDB, err = pipelineDBFactory.BuildWithTeamNameAndName("some-team", "some-pipeline")
		Expect(err).NotTo(HaveOccurred())
	})

	AfterEach(func() {
		err := dbConn.Close()
		Expect(err).NotTo(HaveOccurred())

		err = listener.Close()
		Expect(err).NotTo(HaveOccurred())
	})

	Context("volume data", func() {
		var (
			volumeToInsert  db.Volume
开发者ID:pcfdev-forks,项目名称:atc,代码行数:31,代码来源:db_volumes_test.go


示例8:

	var pipelineDB db.PipelineDB
	var pipelineDBFactory db.PipelineDBFactory
	var dbSharedBehaviorInput = dbSharedBehaviorInput{}

	BeforeEach(func() {
		var err error
		postgresRunner.CreateTestDB()
		dbConn = postgresRunner.Open()
		listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)

		Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
		bus := db.NewNotificationsBus(listener)

		sqlDB = db.NewSQL(lagertest.NewTestLogger("test"), dbConn, bus)

		sqlDB.SaveConfig("some-pipeline", atc.Config{}, db.ConfigVersion(1), db.PipelineUnpaused)
		pipelineDBFactory = db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, sqlDB)

		pipelineDB, err = pipelineDBFactory.BuildWithName("some-pipeline")
		Ω(err).ShouldNot(HaveOccurred())

		dbSharedBehaviorInput.DB = sqlDB
		dbSharedBehaviorInput.PipelineDB = pipelineDB
	})

	AfterEach(func() {
		err := dbConn.Close()
		Ω(err).ShouldNot(HaveOccurred())

		err = listener.Close()
		Ω(err).ShouldNot(HaveOccurred())
开发者ID:utako,项目名称:atc,代码行数:31,代码来源:sqldb_test.go


示例9:

		pipeline, err := database.GetPipelineByTeamNameAndName(team.Name, pipelineName)
		Expect(err).NotTo(HaveOccurred())
		Expect(pipeline.Name).To(Equal(pipelineName))
		Expect(pipeline.Config).To(Equal(config))
		Expect(pipeline.ID).NotTo(Equal(0))

		otherPipeline, err := database.GetPipelineByTeamNameAndName(team.Name, otherPipelineName)
		Expect(err).NotTo(HaveOccurred())
		Expect(otherPipeline.Name).To(Equal(otherPipelineName))
		Expect(otherPipeline.Config).To(Equal(otherConfig))
		Expect(otherPipeline.ID).NotTo(Equal(0))
	})

	It("can order pipelines", func() {
		_, _, err := database.SaveConfig(team.Name, "some-pipeline", atc.Config{}, db.ConfigVersion(1), db.PipelineUnpaused)
		Expect(err).NotTo(HaveOccurred())

		_, _, err = database.SaveConfig(team.Name, "pipeline-1", config, 0, db.PipelineUnpaused)
		Expect(err).NotTo(HaveOccurred())

		_, _, err = database.SaveConfig(team.Name, "pipeline-2", config, 0, db.PipelineUnpaused)
		Expect(err).NotTo(HaveOccurred())

		_, _, err = database.SaveConfig(team.Name, "pipeline-3", config, 0, db.PipelineUnpaused)
		Expect(err).NotTo(HaveOccurred())

		_, _, err = database.SaveConfig(team.Name, "pipeline-4", config, 0, db.PipelineUnpaused)
		Expect(err).NotTo(HaveOccurred())

		_, _, err = database.SaveConfig(team.Name, "pipeline-5", config, 0, db.PipelineUnpaused)
开发者ID:pcfdev-forks,项目名称:atc,代码行数:30,代码来源:db_config_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang db.NewNotificationsBus函数代码示例发布时间:2022-05-23
下一篇:
Golang atc.Worker类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap