Example #1
0
					score, err = cell.ScoreForLRP(BuildLRP("pg", "domain", 0, "arbitrary://random-root-fs", 10, 10), 0.0)
					Expect(score).To(BeZero())
					Expect(err).To(MatchError(rep.ErrorIncompatibleRootfs))
				})
			})
		})
	})

	Describe("ScoreForTask", func() {
		It("factors in number of tasks currently running", func() {
			bigTask := BuildTask("tg-big", "domain", linuxRootFSURL, 20, 10)
			smallTask := BuildTask("tg-small", "domain", linuxRootFSURL, 10, 10)

			By("factoring in the amount of memory taken up by the task")
			bigScore, err := emptyCell.ScoreForTask(bigTask, 0.0)
			Expect(err).NotTo(HaveOccurred())
			smallScore, err := emptyCell.ScoreForTask(smallTask, 0.0)
			Expect(err).NotTo(HaveOccurred())

			Expect(smallScore).To(BeNumerically("<", bigScore))

			By("factoring in the relative emptiness of Cells")
			emptyScore, err := emptyCell.ScoreForTask(smallTask, 0.0)
			Expect(err).NotTo(HaveOccurred())
			score, err := cell.ScoreForTask(smallTask, 0.0)
			Expect(err).NotTo(HaveOccurred())
			Expect(emptyScore).To(BeNumerically("<", score))
		})

		It("factors in memory usage", func() {
Example #2
0
					score, err = cell.ScoreForLRP(BuildLRP("pg", "domain", 0, "arbitrary://random-root-fs", 10, 10))
					Expect(score).To(BeZero())
					Expect(err).To(MatchError(rep.ErrorIncompatibleRootfs))
				})
			})
		})
	})

	Describe("ScoreForTask", func() {
		It("factors in number of tasks currently running", func() {
			bigTask := BuildTask("tg-big", "domain", linuxRootFSURL, 20, 10)
			smallTask := BuildTask("tg-small", "domain", linuxRootFSURL, 10, 10)

			By("factoring in the amount of memory taken up by the task")
			bigScore, err := emptyCell.ScoreForTask(bigTask)
			Expect(err).NotTo(HaveOccurred())
			smallScore, err := emptyCell.ScoreForTask(smallTask)
			Expect(err).NotTo(HaveOccurred())

			Expect(smallScore).To(BeNumerically("<", bigScore))

			By("factoring in the relative emptiness of Cells")
			emptyScore, err := emptyCell.ScoreForTask(smallTask)
			Expect(err).NotTo(HaveOccurred())
			score, err := cell.ScoreForTask(smallTask)
			Expect(err).NotTo(HaveOccurred())
			Expect(emptyScore).To(BeNumerically("<", score))
		})

		It("factors in memory usage", func() {