示例#1
0
			}

			var err error
			build, err = dbEngine.LookupBuild(logger, model)
			Expect(err).NotTo(HaveOccurred())
		})

		Describe("Abort", func() {
			var abortErr error

			JustBeforeEach(func() {
				abortErr = build.Abort(lagertest.NewTestLogger("test"))
			})

			Context("when acquiring the lock succeeds", func() {
				var fakeLease *dbfakes.FakeLease

				BeforeEach(func() {
					fakeLease = new(dbfakes.FakeLease)
					fakeBuildDB.LeaseBuildTrackingReturns(fakeLease, true, nil)
				})

				Context("when the build is active", func() {
					BeforeEach(func() {
						model.Engine = "fake-engine-b"

						fakeBuildDB.GetBuildReturns(model, true, nil)

						fakeBuildDB.AbortBuildStub = func(int) error {
							Expect(fakeBuildDB.LeaseBuildTrackingCallCount()).To(Equal(1))
示例#2
0
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("Scheduler", func() {
	var (
		fakePipelineDB *fakes.FakePipelineDB
		fakeBuildsDB   *fakes.FakeBuildsDB
		factory        *fakes.FakeBuildFactory
		fakeEngine     *enginefakes.FakeEngine
		fakeScanner    *fakes.FakeScanner

		lease *dbfakes.FakeLease

		createdPlan atc.Plan

		job           atc.JobConfig
		resources     atc.ResourceConfigs
		resourceTypes atc.ResourceTypes

		scheduler *Scheduler

		someVersions *algorithm.VersionsDB

		logger *lagertest.TestLogger
	)

	BeforeEach(func() {
		fakePipelineDB = new(fakes.FakePipelineDB)
		fakeBuildsDB = new(fakes.FakeBuildsDB)
		factory = new(fakes.FakeBuildFactory)