Beispiel #1
0
						Version: db.ConfigVersion(3),
					},
				},
			}))
		})

		It("can lookup configs by build id", func() {
			_, err := sqlDB.SaveConfig("my-pipeline", config, 0, db.PipelineUnpaused)

			myPipelineDB, err := pipelineDBFactory.BuildWithName("my-pipeline")
			Expect(err).NotTo(HaveOccurred())

			build, err := myPipelineDB.CreateJobBuild("some-job")
			Expect(err).NotTo(HaveOccurred())

			gottenConfig, _, err := sqlDB.GetConfigByBuildID(build.ID)
			Expect(gottenConfig).To(Equal(config))
		})

		It("can manage multiple pipeline configurations", func() {
			pipelineName := "a-pipeline-name"
			otherPipelineName := "an-other-pipeline-name"

			By("initially being empty")
			Expect(sqlDB.GetConfig(pipelineName)).To(BeZero())
			Expect(sqlDB.GetConfig(otherPipelineName)).To(BeZero())

			By("being able to save the config")
			_, err := sqlDB.SaveConfig(pipelineName, config, 0, db.PipelineUnpaused)
			Expect(err).NotTo(HaveOccurred())
Beispiel #2
0
					Version: db.ConfigVersion(3),
				},
			},
		}))
	})

	It("can lookup configs by build id", func() {
		_, _, err := database.SaveConfig(team.Name, "my-pipeline", config, 0, db.PipelineUnpaused)

		myPipelineDB, err := pipelineDBFactory.BuildWithTeamNameAndName(team.Name, "my-pipeline")
		Expect(err).NotTo(HaveOccurred())

		build, err := myPipelineDB.CreateJobBuild("some-job")
		Expect(err).NotTo(HaveOccurred())

		gottenConfig, _, err := database.GetConfigByBuildID(build.ID)
		Expect(gottenConfig).To(Equal(config))
	})

	It("can manage multiple pipeline configurations", func() {
		pipelineName := "a-pipeline-name"
		otherPipelineName := "an-other-pipeline-name"

		By("initially being empty")
		Expect(database.GetConfig(team.Name, pipelineName)).To(BeZero())
		Expect(database.GetConfig(team.Name, otherPipelineName)).To(BeZero())

		By("being able to save the config")
		_, _, err := database.SaveConfig(team.Name, pipelineName, config, 0, db.PipelineUnpaused)
		Expect(err).NotTo(HaveOccurred())