コード例 #1
0
		execEngine = engine.NewExecEngine(fakeFactory, fakeDelegateFactory, fakeDB)

		fakeDelegate = new(fakes.FakeBuildDelegate)
		fakeDelegateFactory.DelegateReturns(fakeDelegate)

		buildModel = db.Build{ID: 84}
	})

	Describe("Resume", func() {
		Context("get with nil location", func() {
			var (
				getStepFactory *execfakes.FakeStepFactory
				getStep        *execfakes.FakeStep

				fakeDelegate    *fakes.FakeBuildDelegate
				fakeGetDelegate *execfakes.FakeGetDelegate

				plan atc.Plan
			)

			BeforeEach(func() {
				getStepFactory = new(execfakes.FakeStepFactory)
				getStep = new(execfakes.FakeStep)
				getStep.ResultStub = successResult(true)
				getStepFactory.UsingReturns(getStep)
				fakeFactory.GetReturns(getStepFactory)

				fakeDelegate = new(fakes.FakeBuildDelegate)
				fakeDelegateFactory.DelegateReturns(fakeDelegate)
コード例 #2
0
ファイル: conditional_test.go プロジェクト: savaki/atc
			*x = result
			return true

		default:
			return false
		}
	}
}

var _ = Describe("Conditional", func() {
	var (
		inStep *fakes.FakeStep
		repo   *SourceRepository

		fakeStepFactory *fakes.FakeStepFactory
		conditional     Conditional

		outStep *fakes.FakeStep

		step    Step
		process ifrit.Process
	)

	BeforeEach(func() {
		inStep = new(fakes.FakeStep)
		repo = NewSourceRepository()

		fakeStepFactory = new(fakes.FakeStepFactory)

		outStep = new(fakes.FakeStep)
		outStep.ResultStub = successResult(true)
コード例 #3
0
ファイル: exec_engine_test.go プロジェクト: utako/atc
		var (
			fakeDelegate          *fakes.FakeBuildDelegate
			fakeInputDelegate     *execfakes.FakeGetDelegate
			fakeExecutionDelegate *execfakes.FakeTaskDelegate
			fakeOutputDelegate    *execfakes.FakePutDelegate

			buildModel db.Build

			inputPlan  *atc.GetPlan
			outputPlan *atc.ConditionalPlan
			privileged bool
			taskConfig *atc.TaskConfig

			taskConfigPath string

			build engine.Build

			logger *lagertest.TestLogger

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep

			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			outputStepFactory *execfakes.FakeStepFactory
			outputStep        *execfakes.FakeStep

			dependentStepFactory *execfakes.FakeStepFactory
			dependentStep        *execfakes.FakeStep
		)
コード例 #4
0
ファイル: exec_engine_hooks_test.go プロジェクト: utako/atc
		execEngine = engine.NewExecEngine(fakeFactory, fakeDelegateFactory, fakeDB)

		fakeDelegate = new(fakes.FakeBuildDelegate)
		fakeDelegateFactory.DelegateReturns(fakeDelegate)

		buildModel = db.Build{ID: 84}
	})

	Context("running hooked composes", func() {
		var (
			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep

			outputStepFactory *execfakes.FakeStepFactory
			outputStep        *execfakes.FakeStep

			dependentStepFactory *execfakes.FakeStepFactory
			dependentStep        *execfakes.FakeStep
		)

		BeforeEach(func() {
			taskStepFactory = new(execfakes.FakeStepFactory)
			taskStep = new(execfakes.FakeStep)
			taskStep.ResultStub = successResult(true)
			taskStepFactory.UsingReturns(taskStep)
			fakeFactory.TaskReturns(taskStepFactory)

			inputStepFactory = new(execfakes.FakeStepFactory)
コード例 #5
0
ファイル: timeout_step_test.go プロジェクト: savaki/atc
	"github.com/concourse/atc/exec/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/tedsuo/ifrit"
)

var _ = Describe("Timeout Step", func() {
	var (
		fakeStepFactoryStep *fakes.FakeStepFactory

		runStep *fakes.FakeStep

		timeout StepFactory
		step    Step

		startStep chan error
		process   ifrit.Process

		timeoutDuration atc.Duration
	)

	BeforeEach(func() {
		startStep = make(chan error, 1)
		fakeStepFactoryStep = new(fakes.FakeStepFactory)
		runStep = new(fakes.FakeStep)
		fakeStepFactoryStep.UsingReturns(runStep)

	})
コード例 #6
0
ファイル: dependent_get_step_test.go プロジェクト: savaki/atc
		fakeWorkerClient = new(wfakes.FakeClient)

		factory = NewGardenFactory(fakeWorkerClient, fakeTracker, func() string { return "" })

		stdoutBuf = gbytes.NewBuffer()
		stderrBuf = gbytes.NewBuffer()
	})

	Describe("DependentGet", func() {
		var (
			getDelegate    *fakes.FakeGetDelegate
			resourceConfig atc.ResourceConfig
			params         atc.Params
			version        atc.Version
			tags           []string

			inStep *fakes.FakeStep
			repo   *SourceRepository

			step    Step
			process ifrit.Process
		)

		BeforeEach(func() {
			getDelegate = new(fakes.FakeGetDelegate)
			getDelegate.StdoutReturns(stdoutBuf)
			getDelegate.StderrReturns(stderrBuf)

			resourceConfig = atc.ResourceConfig{
				Name:   "some-resource",
				Type:   "some-resource-type",
コード例 #7
0
ファイル: compose_test.go プロジェクト: utako/atc
	. "github.com/onsi/gomega"
	"github.com/tedsuo/ifrit"
)

var _ = Describe("Compose", func() {
	var (
		fakeStepFactoryA *fakes.FakeStepFactory
		fakeStepFactoryB *fakes.FakeStepFactory

		compose StepFactory

		inStep *fakes.FakeStep
		repo   *SourceRepository

		outStepA *fakes.FakeStep
		outStepB *fakes.FakeStep

		startA  chan error
		finishA chan error

		startB  chan error
		finishB chan error

		step    Step
		process ifrit.Process
	)

	BeforeEach(func() {
		fakeStepFactoryA = new(fakes.FakeStepFactory)
		fakeStepFactoryB = new(fakes.FakeStepFactory)
コード例 #8
0
ファイル: identity_test.go プロジェクト: utako/atc
import (
	"os"

	. "github.com/concourse/atc/exec"

	"github.com/concourse/atc/exec/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Identity", func() {
	var (
		inStep *fakes.FakeStep
		repo   *SourceRepository

		identity Identity

		step Step
	)

	BeforeEach(func() {
		identity = Identity{}

		inStep = new(fakes.FakeStep)
		repo = NewSourceRepository()
	})

	JustBeforeEach(func() {
		step = identity.Using(inStep, repo)
	})
コード例 #9
0
// which defaults to returning whatever the previous step was from using. For
// this reason, the input step gets returned as the next step of type identity
// step, which returns nil when ran.

var _ = Describe("Hooked Compose", func() {
	var (
		fakeStepFactoryStep     *fakes.FakeStepFactory
		fakeStepFactoryNextStep *fakes.FakeStepFactory

		hookedCompose StepFactory

		inStep *fakes.FakeStep
		repo   *SourceRepository

		outStep  *fakes.FakeStep
		nextStep *fakes.FakeStep

		startStep  chan error
		finishStep chan error

		startNextStep  chan error
		finishNextStep chan error

		step    Step
		process ifrit.Process
	)

	BeforeEach(func() {
		fakeStepFactoryStep = new(fakes.FakeStepFactory)
		fakeStepFactoryNextStep = new(fakes.FakeStepFactory)
コード例 #10
0
ファイル: exec_engine_test.go プロジェクト: ACPK/atc
		var (
			fakeDelegate          *fakes.FakeBuildDelegate
			fakeInputDelegate     *execfakes.FakeGetDelegate
			fakeExecutionDelegate *execfakes.FakeTaskDelegate
			fakeOutputDelegate    *execfakes.FakePutDelegate

			buildModel       db.Build
			expectedMetadata engine.StepMetadata

			inputPlan  *atc.GetPlan
			outputPlan atc.Plan
			privileged bool
			taskConfig *atc.TaskConfig

			build          engine.Build
			taskConfigPath string

			logger *lagertest.TestLogger

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep

			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			outputStepFactory *execfakes.FakeStepFactory
			outputStep        *execfakes.FakeStep

			dependentStepFactory *execfakes.FakeStepFactory
			dependentStep        *execfakes.FakeStep
		)
コード例 #11
0
ファイル: exec_engine_try_test.go プロジェクト: savaki/atc
		fakeDelegateFactory = new(fakes.FakeBuildDelegateFactory)
		fakeDB = new(fakes.FakeEngineDB)

		execEngine = engine.NewExecEngine(fakeFactory, fakeDelegateFactory, fakeDB)

		fakeDelegate = new(fakes.FakeBuildDelegate)
		fakeDelegateFactory.DelegateReturns(fakeDelegate)

		buildModel = db.Build{ID: 84}
	})

	Context("running try steps", func() {
		var (
			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep
		)

		BeforeEach(func() {
			taskStepFactory = new(execfakes.FakeStepFactory)
			taskStep = new(execfakes.FakeStep)
			taskStep.ResultStub = successResult(true)
			taskStepFactory.UsingReturns(taskStep)
			fakeFactory.TaskReturns(taskStepFactory)

			inputStepFactory = new(execfakes.FakeStepFactory)
			inputStep = new(execfakes.FakeStep)
			inputStep.ResultStub = successResult(true)
			inputStepFactory.UsingReturns(inputStep)
コード例 #12
0
		}

		expectedMetadata = engine.StepMetadata{
			BuildID:      84,
			BuildName:    "42",
			JobName:      "some-job",
			PipelineName: "some-pipeline",
			ExternalURL:  "http://example.com",
		}
	})

	Context("running try steps", func() {
		var (
			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep
		)

		BeforeEach(func() {
			taskStepFactory = new(execfakes.FakeStepFactory)
			taskStep = new(execfakes.FakeStep)
			taskStep.ResultStub = successResult(true)
			taskStepFactory.UsingReturns(taskStep)
			fakeFactory.TaskReturns(taskStepFactory)

			inputStepFactory = new(execfakes.FakeStepFactory)
			inputStep = new(execfakes.FakeStep)
			inputStep.ResultStub = successResult(true)
			inputStepFactory.UsingReturns(inputStep)
コード例 #13
0
ファイル: try_step_test.go プロジェクト: pcfdev-forks/atc
import (
	"errors"

	. "github.com/concourse/atc/exec"

	"github.com/concourse/atc/exec/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Try Step", func() {
	var (
		fakeStepFactoryStep *fakes.FakeStepFactory

		runStep *fakes.FakeStep

		try  StepFactory
		step Step
	)

	BeforeEach(func() {
		fakeStepFactoryStep = new(fakes.FakeStepFactory)
		runStep = new(fakes.FakeStep)
		fakeStepFactoryStep.UsingReturns(runStep)

		try = Try(fakeStepFactoryStep)
		step = try.Using(nil, nil)
	})

	Describe("Result", func() {
		Context("when compared against Success", func() {
コード例 #14
0
ファイル: exec_engine_try_test.go プロジェクト: utako/atc
		fakeDelegateFactory = new(fakes.FakeBuildDelegateFactory)
		fakeDB = new(fakes.FakeEngineDB)

		execEngine = engine.NewExecEngine(fakeFactory, fakeDelegateFactory, fakeDB)

		fakeDelegate = new(fakes.FakeBuildDelegate)
		fakeDelegateFactory.DelegateReturns(fakeDelegate)

		buildModel = db.Build{ID: 84}
	})

	Context("running try steps", func() {
		var (
			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep
		)

		BeforeEach(func() {
			taskStepFactory = new(execfakes.FakeStepFactory)
			taskStep = new(execfakes.FakeStep)
			taskStep.ResultStub = successResult(true)
			taskStepFactory.UsingReturns(taskStep)
			fakeFactory.TaskReturns(taskStepFactory)

			inputStepFactory = new(execfakes.FakeStepFactory)
			inputStep = new(execfakes.FakeStep)
			inputStep.ResultStub = successResult(true)
			inputStepFactory.UsingReturns(inputStep)
コード例 #15
0
ファイル: exec_engine_hooks_test.go プロジェクト: ACPK/atc
		expectedMetadata = engine.StepMetadata{
			BuildID:      84,
			BuildName:    "42",
			JobName:      "some-job",
			PipelineName: "some-pipeline",
		}
	})

	Context("running hooked composes", func() {
		var (
			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep

			outputStepFactory *execfakes.FakeStepFactory
			outputStep        *execfakes.FakeStep

			dependentStepFactory *execfakes.FakeStepFactory
			dependentStep        *execfakes.FakeStep
		)

		BeforeEach(func() {
			taskStepFactory = new(execfakes.FakeStepFactory)
			taskStep = new(execfakes.FakeStep)
			taskStep.ResultStub = successResult(true)
			taskStepFactory.UsingReturns(taskStep)
			fakeFactory.TaskReturns(taskStepFactory)

			inputStepFactory = new(execfakes.FakeStepFactory)
コード例 #16
0
ファイル: exec_engine_timeout_test.go プロジェクト: utako/atc
		fakeDelegateFactory = new(fakes.FakeBuildDelegateFactory)
		fakeDB = new(fakes.FakeEngineDB)

		execEngine = engine.NewExecEngine(fakeFactory, fakeDelegateFactory, fakeDB)

		fakeDelegate = new(fakes.FakeBuildDelegate)
		fakeDelegateFactory.DelegateReturns(fakeDelegate)

		buildModel = db.Build{ID: 84}
	})

	Context("running timeout steps", func() {
		var (
			taskStepFactory *execfakes.FakeStepFactory
			taskStep        *execfakes.FakeStep

			inputStepFactory *execfakes.FakeStepFactory
			inputStep        *execfakes.FakeStep
		)

		BeforeEach(func() {
			taskStepFactory = new(execfakes.FakeStepFactory)
			taskStep = new(execfakes.FakeStep)
			taskStep.ResultStub = successResult(true)
			taskStepFactory.UsingReturns(taskStep)
			fakeFactory.TaskReturns(taskStepFactory)

			inputStepFactory = new(execfakes.FakeStepFactory)
			inputStep = new(execfakes.FakeStep)
			inputStep.ResultStub = successResult(true)
			inputStepFactory.UsingReturns(inputStep)
コード例 #17
0
ファイル: ensure_test.go プロジェクト: ACPK/atc
	. "github.com/onsi/gomega"

	"github.com/tedsuo/ifrit"

	"github.com/concourse/atc/exec"
	"github.com/concourse/atc/exec/fakes"
)

var _ = Describe("Ensure Step", func() {
	var (
		stepFactory *fakes.FakeStepFactory
		hookFactory *fakes.FakeStepFactory

		step *fakes.FakeStep
		hook *fakes.FakeStep

		previousStep *fakes.FakeStep

		repo *exec.SourceRepository

		ensureFactory exec.StepFactory
		ensureStep    exec.Step
	)

	BeforeEach(func() {
		stepFactory = &fakes.FakeStepFactory{}
		hookFactory = &fakes.FakeStepFactory{}

		step = &fakes.FakeStep{}
		hook = &fakes.FakeStep{}

		previousStep = &fakes.FakeStep{}
コード例 #18
0
ファイル: aggregate_test.go プロジェクト: savaki/atc
	"github.com/concourse/atc/exec/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/tedsuo/ifrit"
)

var _ = Describe("Aggregate", func() {
	var (
		fakeStepA *fakes.FakeStepFactory
		fakeStepB *fakes.FakeStepFactory

		aggregate StepFactory

		inStep *fakes.FakeStep
		repo   *SourceRepository

		outStepA *fakes.FakeStep
		outStepB *fakes.FakeStep

		step    Step
		process ifrit.Process
	)

	BeforeEach(func() {
		fakeStepA = new(fakes.FakeStepFactory)
		fakeStepB = new(fakes.FakeStepFactory)

		aggregate = Aggregate{
			fakeStepA,
			fakeStepB,
コード例 #19
0
ファイル: retry_test.go プロジェクト: pcfdev-forks/atc
	. "github.com/concourse/atc/exec"
	"github.com/tedsuo/ifrit"

	"github.com/concourse/atc/exec/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Retry Step", func() {
	var (
		attempt1Factory *fakes.FakeStepFactory
		attempt1Step    *fakes.FakeStep

		attempt2Factory *fakes.FakeStepFactory
		attempt2Step    *fakes.FakeStep

		attempt3Factory *fakes.FakeStepFactory
		attempt3Step    *fakes.FakeStep

		stepFactory StepFactory
		step        Step
	)

	BeforeEach(func() {
		attempt1Factory = new(fakes.FakeStepFactory)
		attempt1Step = new(fakes.FakeStep)
		attempt1Factory.UsingReturns(attempt1Step)

		attempt2Factory = new(fakes.FakeStepFactory)
		attempt2Step = new(fakes.FakeStep)
		attempt2Factory.UsingReturns(attempt2Step)
コード例 #20
0
ファイル: identity_test.go プロジェクト: ACPK/atc
import (
	"os"

	. "github.com/concourse/atc/exec"

	"github.com/concourse/atc/exec/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Identity", func() {
	var (
		inStep *fakes.FakeStep
		repo   *SourceRepository

		identity Identity

		step Step
	)

	BeforeEach(func() {
		identity = Identity{}

		inStep = new(fakes.FakeStep)
		repo = NewSourceRepository()
	})

	JustBeforeEach(func() {
		step = identity.Using(inStep, repo)
	})