コード例 #1
0
			BeforeEach(func() {
				resource := executor.NewResource(512, 512, "")
				req = executor.NewAllocationRequest("banana", &resource, nil)
				_, err := allocationStore.Allocate(logger, &req)
				Expect(err).NotTo(HaveOccurred())
			})

			It("is included in the list", func() {
				allocations := allocationStore.List()
				Expect(allocations).To(HaveLen(1))
				Expect(allocations[0].Guid).To(Equal(req.Guid))
			})

			Context("and then deallocated", func() {
				BeforeEach(func() {
					deallocated := allocationStore.Deallocate(logger, req.Guid)
					Expect(deallocated).To(BeTrue())
				})

				It("is no longer in the list", func() {
					Expect(allocationStore.List()).To(BeEmpty())
				})
			})
		})

		Context("when multiple containers are allocated", func() {
			It("they are added to the store", func() {
				resource1 := executor.NewResource(512, 512, "")
				request1 := executor.NewAllocationRequest("banana-1", &resource1, nil)
				_, err := allocationStore.Allocate(logger, &request1)
				Expect(err).NotTo(HaveOccurred())