當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Config.Groups方法代碼示例

本文整理匯總了Golang中github.com/concourse/atc.Config.Groups方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.Groups方法的具體用法?Golang Config.Groups怎麽用?Golang Config.Groups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/concourse/atc.Config的用法示例。


在下文中一共展示了Config.Groups方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

	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"},
				})
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:31,代碼來源:validate_test.go

示例2:

					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,
開發者ID:simonjjones,項目名稱:fly,代碼行數:31,代碼來源:configure_test.go


注:本文中的github.com/concourse/atc.Config.Groups方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。