예제 #1
0
			It("returns an error", func() {
				Expect(validateErr).To(HaveOccurred())
				Expect(validateErr.Error()).To(ContainSubstring(
					"resources[0] and resources[1] have the same name ('some-resource')",
				))

			})
		})
	})

	Describe("invalid resource types", func() {
		Context("when a resource type has no name", func() {
			BeforeEach(func() {
				config.ResourceTypes = append(config.ResourceTypes, atc.ResourceType{
					Name: "",
				})
			})

			It("returns an error", func() {
				Expect(validateErr).To(HaveOccurred())
				Expect(validateErr.Error()).To(ContainSubstring("resource_types[1] has no name"))
			})
		})

		Context("when a resource has no type", func() {
			BeforeEach(func() {
				config.ResourceTypes = append(config.ResourceTypes, atc.ResourceType{
					Name: "bogus-resource-type",
					Type: "",
				})
예제 #2
0
					copy(newResources, changedConfig.Resources)
					newResources[0].Type = "some-new-type"
					newResources[1] = newResource
					newResources[2].Source = atc.Source{"source-config": 5.0}

					changedConfig.Resources = newResources

					newResourceType := changedConfig.ResourceTypes[1]
					newResourceType.Name = "some-new-resource-type"

					newResourceTypes := make(atc.ResourceTypes, len(changedConfig.ResourceTypes))
					copy(newResourceTypes, changedConfig.ResourceTypes)
					newResourceTypes[0].Type = "some-new-type"
					newResourceTypes[1] = newResourceType

					changedConfig.ResourceTypes = newResourceTypes

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

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

					atcServer.RouteToHandler("PUT", path,
						ghttp.CombineHandlers(
							ghttp.VerifyHeaderKV(atc.ConfigVersionHeader, "42"),
							func(w http.ResponseWriter, r *http.Request) {
								config := getConfig(r)
								Expect(config).To(Equal(payload))