コード例 #1
0
ファイル: task_lifecycle_test.go プロジェクト: Gerg/inigo
			It("should be marked as failed after the expire duration", func() {
				var completedTask receptor.TaskResponse
				Eventually(func() interface{} {
					var err error

					completedTask, err = receptorClient.GetTask(taskGuid)
					Expect(err).NotTo(HaveOccurred())

					return completedTask.State
				}).Should(Equal(receptor.TaskStateCompleted))

				Expect(completedTask.Failed).To(BeTrue())
				Expect(completedTask.FailureReason).To(ContainSubstring("not started within time limit"))

				Expect(inigo_announcement_server.Announcements()).To(BeEmpty())
			})
		})
	})
})

func pollTaskStatus(taskGuid string, result string) {
	var completedTask receptor.TaskResponse
	Eventually(func() interface{} {
		var err error

		completedTask, err = receptorClient.GetTask(taskGuid)
		Expect(err).NotTo(HaveOccurred())

		return completedTask.State
	}).Should(Equal(receptor.TaskStateCompleted))
コード例 #2
0
ファイル: task_test.go プロジェクト: Gerg/inigo
				Eventually(inigo_announcement_server.Announcements).Should(ContainElement("before-memory-overdose"))

				var task receptor.TaskResponse
				Eventually(func() interface{} {
					var err error

					task, err = receptorClient.GetTask(guid)
					Expect(err).NotTo(HaveOccurred())

					return task.State
				}).Should(Equal(receptor.TaskStateCompleted))

				Expect(task.Failed).To(BeTrue())
				Expect(task.FailureReason).To(ContainSubstring("out of memory"))

				Expect(inigo_announcement_server.Announcements()).NotTo(ContainElement("after-memory-overdose"))
			})
		})

		Context("when the command exceeds its file descriptor limit", func() {
			It("should fail the Task", func() {
				nofile := uint64(10)

				err := receptorClient.CreateTask(helpers.TaskCreateRequest(
					guid,
					models.Serial(
						&models.RunAction{
							User: "******",
							Path: "sh",
							Args: []string{"-c", `
set -e