Пример #1
0
		BeforeEach(func() {
			resource := executor.NewResource(512, 512, "")
			req = executor.NewAllocationRequest("banana", &resource, nil)

			_, err := allocationStore.Allocate(logger, &req)
			Expect(err).NotTo(HaveOccurred())
		})

		Context("when the guid is available", func() {
			It("it is marked as INITIALIZING", func() {
				runReq := executor.NewRunRequest(req.Guid, &executor.RunInfo{}, executor.Tags{})
				err := allocationStore.Initialize(logger, &runReq)
				Expect(err).NotTo(HaveOccurred())

				allocation, err := allocationStore.Lookup(req.Guid)
				Expect(err).NotTo(HaveOccurred())

				Expect(allocation.Guid).To(Equal(req.Guid))
				Expect(allocation.State).To(Equal(executor.StateInitializing))
			})
		})

		Context("when the guid is not available", func() {
			It("errors", func() {
				runReq := executor.NewRunRequest("doesnt-exist", &executor.RunInfo{}, executor.Tags{})
				err := allocationStore.Initialize(logger, &runReq)
				Expect(err).To(HaveOccurred())
				Expect(err).To(Equal(executor.ErrContainerNotFound))
			})
		})