Example #1
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("MonitorStep", func() {
	var (
		fakeStep1 *fakes.FakeStep
		fakeStep2 *fakes.FakeStep

		checkSteps chan *fakes.FakeStep

		checkFunc        func() steps.Step
		hasBecomeHealthy <-chan struct{}
		clock            *fakeclock.FakeClock
		fakeStreamer     *fake_log_streamer.FakeLogStreamer

		startTimeout      time.Duration
		healthyInterval   time.Duration
		unhealthyInterval time.Duration

		step   steps.Step
		logger *lagertest.TestLogger
	)

	const numOfConcurrentMonitorSteps = 3

	BeforeEach(func() {
		startTimeout = 0
		healthyInterval = 1 * time.Second
		unhealthyInterval = 500 * time.Millisecond
Example #2
0
	"time"

	"github.com/cloudfoundry-incubator/executor/depot/steps"
	"github.com/cloudfoundry-incubator/executor/depot/steps/fakes"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("TimeoutStep", func() {
	var (
		substepReadyChan    chan struct{}
		substepPerformTime  time.Duration
		substepFinishedChan chan struct{}
		substepPerformError error
		substep             *fakes.FakeStep

		timeout time.Duration
		logger  *lagertest.TestLogger
	)

	BeforeEach(func() {
		substepReadyChan = make(chan struct{})
		substepFinishedChan = make(chan struct{})

		substep = &fakes.FakeStep{
			PerformStub: func() error {
				close(substepReadyChan)
				time.Sleep(substepPerformTime)
				close(substepFinishedChan)
				return substepPerformError
import (
	"errors"
	"sync"

	"github.com/hashicorp/go-multierror"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudfoundry-incubator/executor/depot/steps"
	"github.com/cloudfoundry-incubator/executor/depot/steps/fakes"
)

var _ = Describe("CodependentStep", func() {
	var step steps.Step
	var subStep1 *fakes.FakeStep
	var subStep2 *fakes.FakeStep

	var thingHappened chan bool
	var cancelled chan bool

	var errorOnExit bool

	BeforeEach(func() {
		errorOnExit = false

		thingHappened = make(chan bool, 2)
		cancelled = make(chan bool, 2)

		running := new(sync.WaitGroup)
		running.Add(2)