Example #1
0
	"errors"
	"github.com/cloudfoundry/bosh-agent/agent/action"
	"github.com/cloudfoundry/bosh-agent/agent/applier/applyspec"
	fakeapplyspec "github.com/cloudfoundry/bosh-agent/agent/applier/applyspec/fakes"
	"github.com/cloudfoundry/bosh-agent/agent/scriptrunner"
	fakescript "github.com/cloudfoundry/bosh-agent/agent/scriptrunner/fakes"
	"github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/logger"
	"time"
)

var _ = Describe("RunScript", func() {
	var (
		runScriptAction       action.RunScriptAction
		fakeJobScriptProvider *fakescript.FakeJobScriptProvider
		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"
Example #2
0
import (
	"errors"

	. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"

	"github.com/cloudfoundry/bosh-agent/agent/action"
	fakescript "github.com/cloudfoundry/bosh-agent/agent/scriptrunner/fakes"
	"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())
	})