Пример #1
0
			var taskRequest receptor.TaskCreateRequest

			BeforeEach(func() {
				taskSleepSeconds = 10
				taskGuid = helpers.GenerateGuid()

				taskRequest = helpers.TaskCreateRequestWithMemory(
					taskGuid,
					&models.RunAction{
						User: "******",
						Path: "sh",
						Args: []string{
							"-c",
							// sleep a bit so that we can make assertions around behavior as it's running
							fmt.Sprintf("curl %s; sleep %d", inigo_announcement_server.AnnounceURL(taskGuid), taskSleepSeconds),
						},
					},
					512,
				)
			})

			theFailureReason := func() string {
				taskAfterCancel, err := receptorClient.GetTask(taskGuid)
				if err != nil {
					return ""
				}

				if taskAfterCancel.State != receptor.TaskStateCompleted {
					return ""
				}
Пример #2
0
				return task.State
			}).Should(Equal(receptor.TaskStateCompleted))

			Expect(task.Failed).To(BeFalse())
		})

		Context("when the command exceeds its memory limit", func() {
			It("should fail the Task", func() {
				err := receptorClient.CreateTask(helpers.TaskCreateRequestWithMemoryAndDisk(
					guid,
					models.Serial(
						&models.RunAction{
							User: "******",
							Path: "curl",
							Args: []string{inigo_announcement_server.AnnounceURL("before-memory-overdose")},
						},
						&models.RunAction{
							User: "******",
							Path: "sh",
							Args: []string{"-c", "yes $(yes)"},
						},
						&models.RunAction{
							User: "******",
							Path: "curl",
							Args: []string{inigo_announcement_server.AnnounceURL("after-memory-overdose")},
						},
					),
					10,
					1024,
				))