Esempio n. 1
0
	JustBeforeEach(func() {
		validateErr = ValidateConfig(config)
	})

	Context("when the config is valid", func() {
		It("returns no error", func() {
			Expect(validateErr).NotTo(HaveOccurred())
		})
	})

	Describe("invalid groups", func() {
		Context("when the groups reference a bogus resource", func() {
			BeforeEach(func() {
				config.Groups = append(config.Groups, atc.GroupConfig{
					Name:      "bogus",
					Resources: []string{"bogus-resource"},
				})
			})

			It("returns an error", func() {
				Expect(validateErr).To(HaveOccurred())
				Expect(validateErr.Error()).To(ContainSubstring("unknown resource 'bogus-resource'"))
			})
		})

		Context("when the groups reference a bogus job", func() {
			BeforeEach(func() {
				config.Groups = append(config.Groups, atc.GroupConfig{
					Name: "bogus",
					Jobs: []string{"bogus-job"},
				})
Esempio n. 2
0
					sess, err := gexec.Start(flyCmd, GinkgoWriter, GinkgoWriter)
					Ω(err).ShouldNot(HaveOccurred())

					<-sess.Exited
					Ω(sess.ExitCode()).Should(Equal(1))

					Ω(sess.Err).Should(gbytes.Say("please specify a pipeline name as an argument!"))
				})
			})

			Context("when configuring succeeds", func() {
				BeforeEach(func() {
					newGroup := changedConfig.Groups[1]
					newGroup.Name = "some-new-group"
					changedConfig.Groups[0].Jobs = append(changedConfig.Groups[0].Jobs, "some-new-job")
					changedConfig.Groups = append(changedConfig.Groups[:1], newGroup)

					newResource := changedConfig.Resources[1]
					newResource.Name = "some-new-resource"
					changedConfig.Resources[0].Type = "some-new-type"
					changedConfig.Resources = append(changedConfig.Resources[:1], newResource)

					newJob := changedConfig.Jobs[1]
					newJob.Name = "some-new-job"
					changedConfig.Jobs[0].Serial = false
					changedConfig.Jobs = append(changedConfig.Jobs[:1], newJob)

					path, err := atc.Routes.CreatePathForRoute(atc.SaveConfig, rata.Params{"pipeline_name": "awesome-pipeline"})
					Ω(err).ShouldNot(HaveOccurred())

					atcServer.RouteToHandler("PUT", path,