barScript := &fakescript.FakeScript{}
							barScript.TagReturns("bar")

							jobScriptProvider.NewDrainScriptStub = func(jobName string, params boshdrain.ScriptParams) boshscript.Script {
								Expect(params).To(Equal(boshdrain.NewUpdateParams(currentSpec, newSpec)))

								if jobName == "foo" {
									return fooScript
								} else if jobName == "bar" {
									return barScript
								} else {
									panic("Non-matching update drain script created")
								}
							}

							parallelScript.RunReturns(nil)

							value, err := act()
							Expect(err).ToNot(HaveOccurred())
							Expect(value).To(Equal(0))

							Expect(parallelScript.RunCallCount()).To(Equal(1))
							Expect(jobScriptProvider.NewParallelScriptCallCount()).To(Equal(1))

							scriptName, scripts := jobScriptProvider.NewParallelScriptArgsForCall(0)
							Expect(scriptName).To(Equal("drain"))
							Expect(scripts).To(Equal([]boshscript.Script{fooScript, barScript}))
						})

						It("returns an error when parallel script fails", func() {
							parallelScript.RunReturns(errors.New("fake-error"))
			})
		})

		Context("when script exists", func() {
			var existingScript *fakescript.FakeScript

			BeforeEach(func() {
				existingScript = &fakescript.FakeScript{}
				existingScript.TagReturns("fake-job-1")
				existingScript.PathReturns("path/to/script1")
				existingScript.ExistsReturns(true)
				scripts = append(scripts, existingScript)
			})

			It("executes the script and succeeds", func() {
				existingScript.RunReturns(nil)

				err := parallelScript.Run()
				Expect(err).ToNot(HaveOccurred())

				Expect(existingScript.RunCallCount()).To(Equal(1))
			})

			It("gives an error when script fails", func() {
				existingScript.RunReturns(errors.New("fake-error"))

				err := parallelScript.Run()
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(Equal("1 of 1 run-me scripts failed. Failed Jobs: fake-job-1."))

				Expect(existingScript.RunCallCount()).To(Equal(1))