本文整理汇总了Golang中github.com/concourse/atc/exec/fakes.FakeArtifactSource类的典型用法代码示例。如果您正苦于以下问题:Golang FakeArtifactSource类的具体用法?Golang FakeArtifactSource怎么用?Golang FakeArtifactSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeArtifactSource类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
factory = NewGardenFactory(fakeWorkerClient, fakeTracker)
stdoutBuf = gbytes.NewBuffer()
stderrBuf = gbytes.NewBuffer()
})
Describe("Put", func() {
var (
putDelegate *fakes.FakePutDelegate
resourceConfig atc.ResourceConfig
params atc.Params
tags []string
resourceTypes atc.ResourceTypes
inStep *fakes.FakeStep
repo *SourceRepository
fakeSource *fakes.FakeArtifactSource
fakeOtherSource *fakes.FakeArtifactSource
fakeMountedSource *fakes.FakeArtifactSource
step Step
process ifrit.Process
)
BeforeEach(func() {
putDelegate = new(fakes.FakePutDelegate)
putDelegate.StdoutReturns(stdoutBuf)
putDelegate.StderrReturns(stderrBuf)
resourceConfig = atc.ResourceConfig{
示例2:
JustBeforeEach(func() {
fetchedConfig, fetchErr = configSource.FetchConfig(repo)
})
Context("when the path does not indicate an artifact source", func() {
BeforeEach(func() {
configSource.Path = "foo-bar.yml"
})
It("returns an error", func() {
Ω(fetchErr).Should(Equal(UnspecifiedArtifactSourceError{"foo-bar.yml"}))
})
})
Context("when the file's artifact source can be found in the repository", func() {
var fakeArtifactSource *fakes.FakeArtifactSource
BeforeEach(func() {
fakeArtifactSource = new(fakes.FakeArtifactSource)
repo.RegisterSource("some", fakeArtifactSource)
})
Context("when the artifact source provides a proper file", func() {
var streamedOut *gbytes.Buffer
BeforeEach(func() {
marshalled, err := yaml.Marshal(someConfig)
Ω(err).ShouldNot(HaveOccurred())
streamedOut = gbytes.BufferWithBytes(marshalled)
fakeArtifactSource.StreamFileReturns(streamedOut, nil)
示例3:
Ω(fakeContainer.RunCallCount()).Should(Equal(1))
spec, _ := fakeContainer.RunArgsForCall(0)
Ω(spec).Should(Equal(garden.ProcessSpec{
Path: "ls",
Args: []string{"some", "args"},
Env: []string{"SOME=params"},
Dir: "/tmp/build/a-random-guid",
User: "root",
TTY: &garden.TTYSpec{},
}))
})
})
Context("when the configuration specifies paths for inputs", func() {
var inputSource *fakes.FakeArtifactSource
var otherInputSource *fakes.FakeArtifactSource
BeforeEach(func() {
inputSource = new(fakes.FakeArtifactSource)
otherInputSource = new(fakes.FakeArtifactSource)
configSource.FetchConfigReturns(atc.TaskConfig{
Image: "some-image",
Params: map[string]string{"SOME": "params"},
Run: atc.TaskRunConfig{
Path: "ls",
Args: []string{"some", "args"},
},
Inputs: []atc.TaskInputConfig{
{Name: "some-input", Path: "some-input-configured-path"},
示例4:
var (
repo *SourceRepository
)
BeforeEach(func() {
repo = NewSourceRepository()
})
It("initially does not contain any sources", func() {
source, found := repo.SourceFor("first-source")
Expect(source).To(BeNil())
Expect(found).To(BeFalse())
})
Context("when a source is registered", func() {
var firstSource *fakes.FakeArtifactSource
BeforeEach(func() {
firstSource = new(fakes.FakeArtifactSource)
repo.RegisterSource("first-source", firstSource)
})
It("can be converted to a map", func() {
Expect(repo.AsMap()).To(Equal(map[SourceName]ArtifactSource{
"first-source": firstSource,
}))
})
Describe("SourceFor", func() {
It("yields the source by the given name", func() {
source, found := repo.SourceFor("first-source")
示例5:
fakeWorkerClient = new(wfakes.FakeClient)
factory = NewGardenFactory(fakeWorkerClient, fakeTracker, func() string { return "" })
stdoutBuf = gbytes.NewBuffer()
stderrBuf = gbytes.NewBuffer()
})
Describe("Put", func() {
var (
putDelegate *fakes.FakePutDelegate
resourceConfig atc.ResourceConfig
params atc.Params
tags []string
inStep *fakes.FakeStep
repo *SourceRepository
fakeSource *fakes.FakeArtifactSource
step Step
process ifrit.Process
)
BeforeEach(func() {
putDelegate = new(fakes.FakePutDelegate)
putDelegate.StdoutReturns(stdoutBuf)
putDelegate.StderrReturns(stderrBuf)
resourceConfig = atc.ResourceConfig{
Name: "some-resource",
Type: "some-resource-type",
示例6:
JustBeforeEach(func() {
fetchedConfig, fetchErr = configSource.FetchConfig(repo)
})
Context("when the path does not indicate an artifact source", func() {
BeforeEach(func() {
configSource.Path = "foo-bar.yml"
})
It("returns an error", func() {
Expect(fetchErr).To(Equal(UnspecifiedArtifactSourceError{"foo-bar.yml"}))
})
})
Context("when the file's artifact source can be found in the repository", func() {
var fakeArtifactSource *fakes.FakeArtifactSource
BeforeEach(func() {
fakeArtifactSource = new(fakes.FakeArtifactSource)
repo.RegisterSource("some", fakeArtifactSource)
})
Context("when the artifact source provides a proper file", func() {
var streamedOut *gbytes.Buffer
BeforeEach(func() {
marshalled, err := yaml.Marshal(someConfig)
Expect(err).NotTo(HaveOccurred())
streamedOut = gbytes.BufferWithBytes(marshalled)
fakeArtifactSource.StreamFileReturns(streamedOut, nil)