示例#1
0
文件: runner_test.go 项目: utako/atc
	"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)
		}
示例#2
0
		Context("when getting the build fails", func() {
			BeforeEach(func() {
				pipelineDB.GetJobBuildsReturns(nil, db.Pagination{}, errors.New("oh no!"))
			})

			It("returns 404 Not Found", func() {
				Expect(response.StatusCode).To(Equal(http.StatusNotFound))
			})
		})
	})

	Describe("POST /api/v1/pipelines/:pipeline_name/jobs/:job_name/builds", func() {
		var request *http.Request
		var response *http.Response

		var fakeScheduler *schedulerfakes.FakeBuildScheduler

		BeforeEach(func() {
			var err error

			request, err = http.NewRequest("POST", server.URL+"/api/v1/pipelines/some-pipeline/jobs/some-job/builds", nil)
			Expect(err).NotTo(HaveOccurred())

			fakeScheduler = new(schedulerfakes.FakeBuildScheduler)
			fakeSchedulerFactory.BuildSchedulerReturns(fakeScheduler)
		})

		JustBeforeEach(func() {
			var err error

			response, err = client.Do(request)
示例#3
0
文件: runner_test.go 项目: ACPK/atc
	"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{