本文整理汇总了Golang中github.com/concourse/atc.PlanFactory.NewPlan方法的典型用法代码示例。如果您正苦于以下问题:Golang PlanFactory.NewPlan方法的具体用法?Golang PlanFactory.NewPlan怎么用?Golang PlanFactory.NewPlan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/concourse/atc.PlanFactory
的用法示例。
在下文中一共展示了PlanFactory.NewPlan方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Get: "some-get",
Resource: "some-resource",
},
},
}
})
It("returns the correct plan", func() {
actual, err := buildFactory.Create(input, resources, resourceTypes, nil)
Expect(err).NotTo(HaveOccurred())
expected := expectedPlanFactory.NewPlan(atc.GetPlan{
Type: "git",
Name: "some-get",
Resource: "some-resource",
Pipeline: "some-pipeline",
Source: atc.Source{
"uri": "git://some-resource",
},
ResourceTypes: resourceTypes,
})
Expect(actual).To(testhelpers.MatchPlan(expected))
})
})
Context("with a get for a non-existent resource", func() {
BeforeEach(func() {
input = atc.JobConfig{
Plan: atc.PlanSequence{
{
Get: "some-get",
Resource: "not-a-resource",
示例2:
Task: "second task",
Attempts: 3,
},
},
}, nil, resourceTypes, nil)
Expect(err).NotTo(HaveOccurred())
expected := expectedPlanFactory.NewPlan(atc.RetryPlan{
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "second task",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "second task",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "second task",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
})
Expect(actual).To(testhelpers.MatchPlan(expected))
})
})
Context("when there is a task annotated with 'attempts' and 'on_success'", func() {
It("builds correctly", func() {
示例3:
BeforeEach(func() {
planFactory = atc.NewPlanFactory(123)
build = db.Build{
ID: 128,
Name: "some-build",
}
plan = planFactory.NewPlan(atc.TaskPlan{
Config: &atc.TaskConfig{
Image: "some-image",
Params: map[string]string{
"FOO": "1",
"BAR": "2",
},
Run: atc.TaskRunConfig{
Path: "some-script",
Args: []string{"arg1", "arg2"},
},
},
})
fakeBuildDB.StartBuildReturns(true, nil)
})
JustBeforeEach(func() {
createdBuild, buildErr = dbEngine.CreateBuild(logger, build, plan)
})
示例4:
planFactory atc.PlanFactory
)
BeforeEach(func() {
planFactory = atc.NewPlanFactory(123)
fakeDelegate = new(fakes.FakeBuildDelegate)
fakeDelegateFactory.DelegateReturns(fakeDelegate)
fakeInputDelegate = new(execfakes.FakeGetDelegate)
fakeDelegate.InputDelegateReturns(fakeInputDelegate)
fakeExecutionDelegate = new(execfakes.FakeTaskDelegate)
fakeDelegate.ExecutionDelegateReturns(fakeExecutionDelegate)
inputPlan = planFactory.NewPlan(atc.GetPlan{
Name: "some-input",
Pipeline: "some-pipeline",
})
plan := planFactory.NewPlan(atc.TryPlan{
Step: inputPlan,
})
build, err := execEngine.CreateBuild(logger, buildModel, plan)
Expect(err).NotTo(HaveOccurred())
build.Resume(logger)
})
It("constructs the step correctly", func() {
Expect(fakeFactory.GetCallCount()).To(Equal(1))
logger, metadata, sourceName, workerID, workerMetadata, delegate, _, _, _, _, _ := fakeFactory.GetArgsForCall(0)
Expect(logger).NotTo(BeNil())
示例5:
fakeFactory.DependentGetReturns(dependentStepFactory)
})
Describe("with a putget in an aggregate", func() {
var (
putPlan atc.Plan
dependentGetPlan atc.Plan
otherPutPlan atc.Plan
otherDependentGetPlan atc.Plan
)
BeforeEach(func() {
putPlan = planFactory.NewPlan(atc.PutPlan{
Name: "some-put",
Resource: "some-output-resource",
Type: "put",
Source: atc.Source{"some": "source"},
Params: atc.Params{"some": "params"},
Pipeline: "some-pipeline",
})
dependentGetPlan = planFactory.NewPlan(atc.DependentGetPlan{
Name: "some-get",
Resource: "some-input-resource",
Type: "get",
Source: atc.Source{"some": "source"},
Params: atc.Params{"another": "params"},
Pipeline: "some-pipeline",
})
otherPutPlan = planFactory.NewPlan(atc.PutPlan{
Name: "some-put-2",
Resource: "some-output-resource-2",
示例6:
Source: atc.Source{"some": "custom-source"},
},
}
})
Context("When there is a task with a timeout", func() {
It("builds correctly", func() {
actual, err := buildFactory.Create(atc.JobConfig{
Plan: atc.PlanSequence{
{
Task: "first task",
Timeout: "10s",
},
},
}, nil, resourceTypes, nil)
Expect(err).NotTo(HaveOccurred())
expected := expectedPlanFactory.NewPlan(atc.TimeoutPlan{
Duration: "10s",
Step: expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "first task",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
})
Expect(actual).To(Equal(expected))
})
})
})
示例7:
It("builds the plan correctly", func() {
actual, err := buildFactory.Create(input, resources, resourceTypes, nil)
Expect(err).NotTo(HaveOccurred())
expected := expectedPlanFactory.NewPlan(atc.OnFailurePlan{
Step: expectedPlanFactory.NewPlan(atc.DoPlan{
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "those who resist our will",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "those who also resist our will",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "third task",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
}),
Next: expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "some other failure",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
})
Expect(actual).To(testhelpers.MatchPlan(expected))
})
})
示例8:
},
},
},
}, resources, resourceTypes, nil)
Expect(err).NotTo(HaveOccurred())
expected := expectedPlanFactory.NewPlan(atc.DoPlan{
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "some thing",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "some thing-2",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
expectedPlanFactory.NewPlan(atc.DoPlan{
expectedPlanFactory.NewPlan(atc.TaskPlan{
Name: "some other thing",
Pipeline: "some-pipeline",
ResourceTypes: resourceTypes,
}),
}),
})
Expect(actual).To(testhelpers.MatchPlan(expected))
})
})
Context("when I have an aggregate inside a do", func() {
It("returns the correct plan", func() {
示例9:
It("returns the correct plan", func() {
actual, err := buildFactory.Create(input, resources, resourceTypes, nil)
Expect(err).NotTo(HaveOccurred())
expected := expectedPlanFactory.NewPlan(atc.OnSuccessPlan{
Step: expectedPlanFactory.NewPlan(atc.PutPlan{
Type: "git",
Name: "some-put",
Resource: "some-resource",
Pipeline: "some-pipeline",
Source: atc.Source{
"uri": "git://some-resource",
},
ResourceTypes: resourceTypes,
}),
Next: expectedPlanFactory.NewPlan(atc.DependentGetPlan{
Type: "git",
Name: "some-put",
Resource: "some-resource",
Pipeline: "some-pipeline",
Source: atc.Source{
"uri": "git://some-resource",
},
ResourceTypes: resourceTypes,
}),
})
Expect(actual).To(testhelpers.MatchPlan(expected))
})
})
Context("with a put for a non-existent resource", func() {