コード例 #1
0
ファイル: task_db_test.go プロジェクト: emc-xchallenge/bbs
					Expect(err).NotTo(HaveOccurred())

					tasks := filterByState(models.Task_Completed)

					task := tasks[0]
					Expect(task.Failed).To(BeTrue())
					Expect(task.FailureReason).To(Equal("because i said so"))
					Expect(task.UpdatedAt).To(Equal(clock.Now().UnixNano()))
					Expect(task.FirstCompletedAt).To(Equal(clock.Now().UnixNano()))
					Expect(task.CellId).To(BeEmpty())
				})

				Context("and completing succeeds", func() {
					Context("and the task has a complete URL", func() {
						BeforeEach(func() {
							taskDef.CompletionCallbackUrl = "bogus"
						})

						It("eventually causes the workpool to complete its callback work", func() {
							err := etcdDB.CompleteTask(logger, taskGuid, cellId, true, "because i said so", "a result")
							Expect(err).NotTo(HaveOccurred())
							Eventually(fakeTaskCompletionClient.SubmitCallCount).Should(Equal(1))
						})
					})

					Context("but the task has no complete URL", func() {
						BeforeEach(func() {
							taskDef.CompletionCallbackUrl = ""
						})

						It("does not complete the task callback", func() {