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


Golang Config.Resources方法代码示例

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


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

示例1:

					Jobs: []string{"bogus-job"},
				})
			})

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

	Describe("invalid resources", func() {
		Context("when a resource has no name", func() {
			BeforeEach(func() {
				config.Resources = append(config.Resources, atc.ResourceConfig{
					Name: "",
				})
			})

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

		Context("when a resource has no type", func() {
			BeforeEach(func() {
				config.Resources = append(config.Resources, atc.ResourceConfig{
					Name: "bogus-resource",
					Type: "",
				})
开发者ID:pcfdev-forks,项目名称:atc,代码行数:31,代码来源:validate_test.go

示例2:

				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"

					newResources := make(atc.ResourceConfigs, len(changedConfig.Resources))
					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)
开发者ID:ArthurHlt,项目名称:fly,代码行数:31,代码来源:set_pipeline_test.go

示例3:

					Ω(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,
						ghttp.CombineHandlers(
							ghttp.VerifyHeaderKV(atc.ConfigVersionHeader, "42"),
							func(w http.ResponseWriter, r *http.Request) {
								config, state := getConfigAndPausedState(r)
								Ω(config).Should(Equal(payload))
开发者ID:simonjjones,项目名称:fly,代码行数:30,代码来源:configure_test.go

示例4:

					baggageCollectorLogger,
					fakeWorkerClient,
					fakeBaggageCollectorDB,
					fakePipelineDBFactory,
					expectedOldResourceGracePeriod,
					expectedOneOffTTL,
				)

				var savedPipelines []db.SavedPipeline
				fakePipelineDBs := make(map[string]*dbfakes.FakePipelineDB)

				for name, data := range example.pipelineData {
					config := atc.Config{}

					for _, resourceData := range data {
						config.Resources = append(config.Resources, resourceData.config)
					}

					savedPipelines = append(savedPipelines, db.SavedPipeline{
						Pipeline: db.Pipeline{
							Name:   name,
							Config: config,
						},
					})

					fakePipelineDB := new(dbfakes.FakePipelineDB)

					savedVersionsForEachResource := make(map[string][]db.SavedVersionedResource)

					for _, resourceInfo := range data {
						var savedVersions []db.SavedVersionedResource
开发者ID:pcfdev-forks,项目名称:atc,代码行数:31,代码来源:baggage_collector_test.go


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