예제 #1
0
	"github.com/cloudfoundry-incubator/auctioneer"
	"github.com/cloudfoundry-incubator/bbs/models"
	"github.com/cloudfoundry-incubator/bbs/models/test/model_helpers"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("TaskDB", func() {
	const (
		taskGuid = "some-guid"
		domain   = "some-domain"
		cellId   = "cell-id"
	)
	var (
		taskDef *models.TaskDefinition
	)

	filterByState := func(state models.Task_State) []*models.Task {
		allTasks, err := etcdDB.Tasks(logger, models.TaskFilter{})
		Expect(err).NotTo(HaveOccurred())
		tasks := []*models.Task{}
		for _, task := range allTasks {
			if task.State == state {
				tasks = append(tasks, task)
			}
		}
		return tasks
	}

	Describe("Tasks", func() {
예제 #2
0
			It("provides relevant error information", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
				response := models.TaskResponse{}
				err := response.Unmarshal(responseRecorder.Body.Bytes())
				Expect(err).NotTo(HaveOccurred())

				Expect(response.Error).To(Equal(models.ErrUnknownError))
			})
		})
	})

	Describe("DesireTask_r0", func() {
		var (
			taskGuid = "task-guid"
			domain   = "domain"
			taskDef  *models.TaskDefinition
		)

		BeforeEach(func() {
			taskDef = model_helpers.NewValidTaskDefinition()
			taskDef.Action = &models.Action{
				TimeoutAction: &models.TimeoutAction{
					Action: models.WrapAction(&models.UploadAction{
						From: "web_location",
						To:   "potato",
						User: "******",
					}),
					DeprecatedTimeoutNs: int64(time.Second),
				},
			}