本文整理汇总了Golang中github.com/cloudfoundry-incubator/lattice/ltc/task_runner/fake_task_runner.FakeTaskRunner.SubmitTaskArgsForCall方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeTaskRunner.SubmitTaskArgsForCall方法的具体用法?Golang FakeTaskRunner.SubmitTaskArgsForCall怎么用?Golang FakeTaskRunner.SubmitTaskArgsForCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/lattice/ltc/task_runner/fake_task_runner.FakeTaskRunner
的用法示例。
在下文中一共展示了FakeTaskRunner.SubmitTaskArgsForCall方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
tmpFile, err = ioutil.TempFile(tmpDir, "tmp_json")
Expect(err).ToNot(HaveOccurred())
})
It("submits a task from json", func() {
jsonContents := []byte(`{"Value":"test value"}`)
ioutil.WriteFile(tmpFile.Name(), jsonContents, 0700)
args := []string{tmpFile.Name()}
fakeTaskRunner.SubmitTaskReturns("some-task", nil)
test_helpers.ExecuteCommandWithArgs(submitTaskCommand, args)
Expect(outputBuffer).To(test_helpers.Say(colors.Green("Successfully submitted some-task")))
Expect(fakeTaskRunner.SubmitTaskCallCount()).To(Equal(1))
Expect(fakeTaskRunner.SubmitTaskArgsForCall(0)).To(Equal(jsonContents))
})
It("prints an error returned by the task_runner", func() {
jsonContents := []byte(`{"Value":"test value"}`)
ioutil.WriteFile(tmpFile.Name(), jsonContents, 0700)
args := []string{tmpFile.Name()}
fakeTaskRunner.SubmitTaskReturns("some-task", errors.New("taskypoo"))
test_helpers.ExecuteCommandWithArgs(submitTaskCommand, args)
Expect(fakeTaskRunner.SubmitTaskCallCount()).To(Equal(1))
Expect(fakeTaskRunner.SubmitTaskArgsForCall(0)).To(Equal(jsonContents))
Expect(outputBuffer).To(test_helpers.Say("Error submitting some-task: taskypoo"))
Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.CommandFailed}))