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


Golang atc.Config類代碼示例

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


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

示例1:

package config_test

import (
	"github.com/concourse/atc"
	. "github.com/concourse/atc/config"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("ValidateConfig", func() {
	var (
		config atc.Config

		validateErr error
	)

	BeforeEach(func() {
		config = atc.Config{
			Groups: atc.GroupConfigs{
				{
					Name:      "some-group",
					Jobs:      []string{"some-job"},
					Resources: []string{"some-resource"},
				},
			},

			Resources: atc.ResourceConfigs{
				{
					Name: "some-resource",
					Type: "some-type",
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:31,代碼來源:validate_test.go

示例2:

					Eventually(sess).Should(gbytes.Say(`apply configuration\? \(y/n\): `))
					fmt.Fprintln(stdin, "y")
					Eventually(sess).Should(gbytes.Say("configuration updated"))

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

					Ω(atcServer.ReceivedRequests()).Should(HaveLen(2))
				})
			})
		})

		Describe("setting", func() {
			var (
				changedConfig atc.Config

				payload    []byte
				configFile *os.File
			)

			BeforeEach(func() {
				var err error

				configFile, err = ioutil.TempFile("", "fly-config-file")
				Ω(err).ShouldNot(HaveOccurred())

				changedConfig = config

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

				atcServer.RouteToHandler("GET", path,
開發者ID:simonjjones,項目名稱:fly,代碼行數:32,代碼來源:configure_test.go

示例3:

				fakePipelineDBFactory = new(dbfakes.FakePipelineDBFactory)

				baggageCollector = lostandfound.NewBaggageCollector(
					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)
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:31,代碼來源:baggage_collector_test.go

示例4:

package atc_test

import (
	"github.com/concourse/atc"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Config", func() {
	var config atc.Config

	Describe("determining if a job's builds are publically viewable", func() {
		Context("when the job is publically viewable", func() {
			BeforeEach(func() {
				config = atc.Config{
					Jobs: atc.JobConfigs{
						{
							Name:   "some-job",
							Public: true,
						},
					},
				}
			})

			It("returns true", func() {
				public, _ := config.JobIsPublic("some-job")
				Expect(public).To(BeTrue())
			})

			It("does not error", func() {
開發者ID:ACPK,項目名稱:atc,代碼行數:31,代碼來源:atc_test.go

示例5: convertJobsToPlan

func (db PlanConvertingConfigDB) convertJobsToPlan(config atc.Config) atc.Config {
	convertedJobs := make([]atc.JobConfig, len(config.Jobs))
	copy(convertedJobs, config.Jobs)

	for ji, job := range convertedJobs {
		if len(job.Plan) > 0 { // skip jobs already converted to plans
			continue
		}

		convertedSequence := atc.PlanSequence{}

		inputAggregates := make(atc.PlanSequence, len(job.InputConfigs))
		for ii, input := range job.InputConfigs {
			name := input.RawName
			resource := input.Resource
			if name == "" {
				name = input.Resource
				resource = ""
			}

			inputAggregates[ii] = atc.PlanConfig{
				Get:      name,
				Resource: resource,
				Trigger:  input.Trigger,
				Passed:   input.Passed,
				Params:   input.Params,
			}
		}

		if len(inputAggregates) > 0 {
			convertedSequence = append(convertedSequence, atc.PlanConfig{
				Aggregate: &inputAggregates,
			})
		}

		if job.TaskConfig != nil || job.TaskConfigPath != "" {
			convertedSequence = append(convertedSequence, atc.PlanConfig{
				Task:           "build", // default name
				TaskConfigPath: job.TaskConfigPath,
				TaskConfig:     job.TaskConfig,
				Privileged:     job.Privileged,
			})
		}

		outputAggregates := make(atc.PlanSequence, len(job.OutputConfigs))
		for oi, output := range job.OutputConfigs {
			var conditions *atc.Conditions
			if output.RawPerformOn != nil { // NOT len(0)
				conditionsCasted := atc.Conditions(output.RawPerformOn)
				conditions = &conditionsCasted
			}

			outputAggregates[oi] = atc.PlanConfig{
				Put:        output.Resource,
				Conditions: conditions,
				Params:     output.Params,
			}
		}

		if len(outputAggregates) > 0 {
			convertedSequence = append(convertedSequence, atc.PlanConfig{
				Aggregate: &outputAggregates,
			})
		}

		// zero-out old-style config so they're omitted from new payload
		convertedJobs[ji].InputConfigs = nil
		convertedJobs[ji].OutputConfigs = nil
		convertedJobs[ji].TaskConfigPath = ""
		convertedJobs[ji].TaskConfig = nil
		convertedJobs[ji].Privileged = false

		convertedJobs[ji].Plan = convertedSequence
	}

	config.Jobs = convertedJobs

	return config
}
開發者ID:utako,項目名稱:atc,代碼行數:79,代碼來源:plan_converting_config_db.go


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