Ejemplo n.º 1
0
		specService           *fakeapplyspec.FakeV1Service
		log                   logger.Logger
		options               map[string]interface{}
		scriptName            string
	)

	createFakeJob := func(jobName string) {
		specService.Spec.JobSpec.JobTemplateSpecs = append(specService.Spec.JobSpec.JobTemplateSpecs, applyspec.JobTemplateSpec{Name: jobName})
	}

	BeforeEach(func() {
		log = logger.NewLogger(logger.LevelNone)
		fakeJobScriptProvider = &fakescript.FakeJobScriptProvider{}
		specService = fakeapplyspec.NewFakeV1Service()
		createFakeJob("fake-job-1")
		runScriptAction = action.NewRunScript(fakeJobScriptProvider, specService, log)
		scriptName = "run-me"
		options = make(map[string]interface{})
	})

	It("is asynchronous", func() {
		Expect(runScriptAction.IsAsynchronous()).To(BeTrue())
	})

	It("is not persistent", func() {
		Expect(runScriptAction.IsPersistent()).To(BeFalse())
	})

	Context("when script exists", func() {

		var existingScript *fakescript.FakeScript
Ejemplo n.º 2
0
	"github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/logger"
)

var _ = Describe("RunScript", func() {
	var (
		runScriptAction    action.RunScriptAction
		fakeScriptProvider *fakescript.FakeScriptProvider
		log                logger.Logger
		options            map[string]interface{}
		scriptPaths        []string
	)

	BeforeEach(func() {
		log = logger.NewLogger(logger.LevelNone)
		fakeScriptProvider = &fakescript.FakeScriptProvider{}
		runScriptAction = action.NewRunScript(fakeScriptProvider, log)
		scriptPaths = []string{"run-me"}
		options = make(map[string]interface{})
	})

	It("is synchronous", func() {
		Expect(runScriptAction.IsAsynchronous()).To(BeTrue())
	})

	It("is not persistent", func() {
		Expect(runScriptAction.IsPersistent()).To(BeFalse())
	})

	Context("when script exists", func() {

		var existingScript *fakescript.FakeScript