Ejemplo n.º 1
0
	BeforeEach(func() {
		fakeScripts = make(map[string]*fakedrain.FakeScript)
		logger = boshlog.NewLogger(boshlog.LevelNone)
		notifier = fakenotif.NewFakeNotifier()
		specService = fakeas.NewFakeV1Service()
		jobScriptProvider = &fakescript.FakeJobScriptProvider{}
		jobSupervisor = fakejobsuper.NewFakeJobSupervisor()
		action = NewDrain(notifier, specService, jobScriptProvider, jobSupervisor, logger)
	})

	BeforeEach(func() {
		jobScriptProvider.NewDrainScriptStub = func(jobName string, params boshdrain.ScriptParams) boshscript.CancellableScript {
			_, exists := fakeScripts[jobName]
			if !exists {
				fakeScript := fakedrain.NewFakeScript(jobName)
				fakeScript.Params = params
				fakeScripts[jobName] = fakeScript
			}
			return fakeScripts[jobName]
		}
	})

	AssertActionIsAsynchronous(action)
	AssertActionIsNotPersistent(action)
	AssertActionIsLoggable(action)

	AssertActionIsNotResumable(action)

	Describe("Run", func() {
		var (
			parallelScript *fakescript.FakeCancellableScript