示例#1
0
			}

			var err error
			build, err = dbEngine.LookupBuild(model)
			Ω(err).ShouldNot(HaveOccurred())
		})

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

			JustBeforeEach(func() {
				abortErr = build.Abort()
			})

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

				BeforeEach(func() {
					fakeLock = new(dbfakes.FakeLock)
					fakeLocker.AcquireWriteLockImmediatelyReturns(fakeLock, nil)
				})

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

						fakeBuildDB.GetBuildReturns(model, nil)

						fakeBuildDB.AbortBuildStub = func(int) error {
							Ω(fakeLocker.AcquireWriteLockImmediatelyCallCount()).Should(Equal(1))
示例#2
0
文件: radar_test.go 项目: utako/atc
	"github.com/concourse/atc/resource"
	rfakes "github.com/concourse/atc/resource/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Radar", func() {
	var (
		fakeTracker *rfakes.FakeTracker
		fakeRadarDB *fakes.FakeRadarDB
		interval    time.Duration

		radar *Radar

		resourceConfig atc.ResourceConfig
		savedResource  db.SavedResource

		locker               *fakes.FakeLocker
		readLock             *dbfakes.FakeLock
		writeLock            *dbfakes.FakeLock
		writeImmediatelyLock *dbfakes.FakeLock

		process ifrit.Process
	)

	BeforeEach(func() {
		fakeTracker = new(rfakes.FakeTracker)
		fakeRadarDB = new(fakes.FakeRadarDB)
		locker = new(fakes.FakeLocker)
		interval = 100 * time.Millisecond