本文整理匯總了Golang中github.com/concourse/atc/db/fakes.FakePipelineDB類的典型用法代碼示例。如果您正苦於以下問題:Golang FakePipelineDB類的具體用法?Golang FakePipelineDB怎麽用?Golang FakePipelineDB使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakePipelineDB類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
import (
"errors"
"io/ioutil"
"net/http"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
dbfakes "github.com/concourse/atc/db/fakes"
)
var _ = Describe("Resources API", func() {
var pipelineDB *dbfakes.FakePipelineDB
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDBFactory.BuildWithNameReturns(pipelineDB, nil)
})
Describe("GET /api/v1/pipelines/:pipeline_name/resources", func() {
var response *http.Response
JustBeforeEach(func() {
var err error
response, err = client.Get(server.URL + "/api/v1/pipelines/a-pipeline/resources")
Expect(err).NotTo(HaveOccurred())
示例2:
Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
})
})
It("looks up the pipeline in the db via the url param", func() {
Expect(pipelinesDB.GetPipelineByTeamNameAndNameCallCount()).To(Equal(1))
teamName, actualPipelineName := pipelinesDB.GetPipelineByTeamNameAndNameArgsForCall(0)
Expect(actualPipelineName).To(Equal("some-specific-pipeline"))
Expect(teamName).To(Equal(atc.DefaultTeamName))
})
})
Describe("DELETE /api/v1/pipelines/:pipeline_name", func() {
var response *http.Response
var pipelineDB *dbfakes.FakePipelineDB
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDBFactory.BuildWithTeamNameAndNameReturns(pipelineDB, nil)
})
JustBeforeEach(func() {
pipelineName := "a-pipeline-name"
req, err := http.NewRequest("DELETE", server.URL+"/api/v1/pipelines/"+pipelineName, nil)
Expect(err).NotTo(HaveOccurred())
req.Header.Set("Content-Type", "application/json")
response, err = client.Do(req)
示例3:
"net/http"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/concourse/atc"
"github.com/concourse/atc/config"
"github.com/concourse/atc/db"
"github.com/concourse/atc/db/algorithm"
dbfakes "github.com/concourse/atc/db/fakes"
schedulerfakes "github.com/concourse/atc/scheduler/fakes"
)
var _ = Describe("Jobs API", func() {
var pipelineDB *dbfakes.FakePipelineDB
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDBFactory.BuildWithTeamNameAndNameReturns(pipelineDB, nil)
})
Describe("GET /api/v1/pipelines/:pipeline_name/jobs/:job_name", func() {
var response *http.Response
JustBeforeEach(func() {
var err error
response, err = client.Get(server.URL + "/api/v1/pipelines/some-pipeline/jobs/some-job")
Expect(err).NotTo(HaveOccurred())
示例4:
"github.com/pivotal-golang/lager"
"github.com/pivotal-golang/lager/lagertest"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Runner", func() {
var (
locker *fakes.FakeLocker
pipelineDB *dbfakes.FakePipelineDB
scheduler *fakes.FakeBuildScheduler
noop bool
lock *dbfakes.FakeLock
initialConfig atc.Config
process ifrit.Process
)
BeforeEach(func() {
locker = new(fakes.FakeLocker)
pipelineDB = new(dbfakes.FakePipelineDB)
scheduler = new(fakes.FakeBuildScheduler)
noop = false
scheduler.TryNextPendingBuildStub = func(lager.Logger, atc.JobConfig, atc.ResourceConfigs) Waiter {
return new(sync.WaitGroup)
}
示例5:
)
var _ = Describe("Baggage-collecting image resource volumes", func() {
Context("when there is a single job", func() {
var (
fakeWorkerClient *wfakes.FakeClient
workerA *wfakes.FakeWorker
workerB *wfakes.FakeWorker
workerBBaggageClaimClient *bcfakes.FakeClient
dockerVolume *bcfakes.FakeVolume
workerC *wfakes.FakeWorker
workerCBaggageClaimClient *bcfakes.FakeClient
crossedWiresVolume *bcfakes.FakeVolume
fakeBaggageCollectorDB *fakes.FakeBaggageCollectorDB
fakePipelineDBFactory *dbfakes.FakePipelineDBFactory
expectedOldVersionTTL = 4 * time.Minute
expectedLatestVersionTTL = time.Duration(0)
expectedOneOffTTL = 5 * time.Hour
baggageCollector lostandfound.BaggageCollector
savedPipeline db.SavedPipeline
fakePipelineDB *dbfakes.FakePipelineDB
)
BeforeEach(func() {
fakeWorkerClient = new(wfakes.FakeClient)
示例6:
import (
"encoding/json"
"errors"
"io/ioutil"
"net/http"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
dbfakes "github.com/concourse/atc/db/fakes"
)
var _ = Describe("Jobs API", func() {
var pipelineDB *dbfakes.FakePipelineDB
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDBFactory.BuildWithNameReturns(pipelineDB, nil)
})
Describe("GET /api/v1/pipelines/:pipeline_name/jobs/:job_name", func() {
var response *http.Response
JustBeforeEach(func() {
var err error
response, err = client.Get(server.URL + "/api/v1/pipelines/some-pipeline/jobs/some-job")
Ω(err).ShouldNot(HaveOccurred())
示例7:
wfakes "github.com/concourse/atc/worker/fakes"
bcfakes "github.com/concourse/baggageclaim/fakes"
)
var _ = Describe("Baggage-collecting image resource volumes created by one-off builds", func() {
var (
fakeWorkerClient *wfakes.FakeClient
worker1 *wfakes.FakeWorker
worker2 *wfakes.FakeWorker
baggageClaimClient2 *bcfakes.FakeClient
volume2 *bcfakes.FakeVolume
fakeBaggageCollectorDB *fakes.FakeBaggageCollectorDB
fakePipelineDBFactory *dbfakes.FakePipelineDBFactory
expectedOldVersionTTL = 4 * time.Minute
expectedLatestVersionTTL = time.Duration(0)
expectedOneOffTTL = 5 * time.Hour
baggageCollector lostandfound.BaggageCollector
savedPipeline db.SavedPipeline
fakePipelineDB *dbfakes.FakePipelineDB
)
BeforeEach(func() {
fakeWorkerClient = new(wfakes.FakeClient)
worker1 = new(wfakes.FakeWorker)
示例8:
"github.com/pivotal-golang/lager/lagertest"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Runner", func() {
var (
pipelineDB *dbfakes.FakePipelineDB
scheduler *fakes.FakeBuildScheduler
noop bool
lease *dbfakes.FakeLease
initialConfig atc.Config
someVersions *algorithm.VersionsDB
process ifrit.Process
)
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDB.GetPipelineNameReturns("some-pipeline")
scheduler = new(fakes.FakeBuildScheduler)
noop = false
someVersions = &algorithm.VersionsDB{
BuildOutputs: []algorithm.BuildOutput{
示例9:
"net/http"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/concourse/atc"
"github.com/concourse/atc/config"
"github.com/concourse/atc/db"
"github.com/concourse/atc/db/algorithm"
dbfakes "github.com/concourse/atc/db/fakes"
schedulerfakes "github.com/concourse/atc/scheduler/fakes"
)
var _ = Describe("Jobs API", func() {
var pipelineDB *dbfakes.FakePipelineDB
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDBFactory.BuildWithNameReturns(pipelineDB, nil)
})
Describe("GET /api/v1/pipelines/:pipeline_name/jobs/:job_name", func() {
var response *http.Response
JustBeforeEach(func() {
var err error
response, err = client.Get(server.URL + "/api/v1/pipelines/some-pipeline/jobs/some-job")
Expect(err).NotTo(HaveOccurred())
示例10:
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
for i, version := range resourceInfo.versions {
disabled := false
for _, j := range resourceInfo.versionsToDisable {
if i == j {
disabled = true
}
}
if !disabled {
示例11:
Ω(body).Should(MatchJSON(`[
{
"name": "a-pipeline",
"url": "/pipelines/a-pipeline",
"paused": false
},{
"name": "another-pipeline",
"url": "/pipelines/another-pipeline",
"paused": true
}]`))
})
})
Describe("DELETE /api/v1/pipelines/:pipeline_name", func() {
var response *http.Response
var pipelineDB *dbfakes.FakePipelineDB
BeforeEach(func() {
pipelineDB = new(dbfakes.FakePipelineDB)
pipelineDBFactory.BuildWithNameReturns(pipelineDB, nil)
})
JustBeforeEach(func() {
pipelineName := "a-pipeline-name"
req, err := http.NewRequest("DELETE", server.URL+"/api/v1/pipelines/"+pipelineName, nil)
Ω(err).ShouldNot(HaveOccurred())
req.Header.Set("Content-Type", "application/json")
response, err = client.Do(req)
示例12:
},
ID: 123,
ExpiresIn: expectedOldResourceGracePeriod,
}
returnedVolumes = []db.SavedVolume{returnedSavedVolume}
})
JustBeforeEach(func() {
fakeBaggageCollectorDB.GetVolumesReturns(returnedVolumes, nil)
})
Context("when the worker for a newest resource no longer exists", func() {
var (
fakeSavedPipeline db.SavedPipeline
fakePipelineDB dbfakes.FakePipelineDB
fakeSavedVersionedResource db.SavedVersionedResource
)
BeforeEach(func() {
fakeSavedPipeline = db.SavedPipeline{
Pipeline: db.Pipeline{
Name: "some-pipeline",
Config: atc.Config{
Resources: atc.ResourceConfigs{
atc.ResourceConfig{
Name: "our-resource",
Type: "git",
Source: atc.Source{"some": "source"},
},
},