Beispiel #1
0
			*BuildLRP("pg-1", "domain", 0, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-1", "domain", 1, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-2", "domain", 0, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-3", "domain", 0, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-4", "domain", 0, linuxRootFSURL, 10, 20),
		})
		cell = auctionrunner.NewCell(logger, "the-cell", client, state)
	})

	Describe("ScoreForLRP", func() {
		It("factors in memory usage", func() {
			bigInstance := BuildLRP("pg-big", "domain", 0, linuxRootFSURL, 20, 10)
			smallInstance := BuildLRP("pg-small", "domain", 0, linuxRootFSURL, 10, 10)

			By("factoring in the amount of memory taken up by the instance")
			bigScore, err := emptyCell.ScoreForLRP(bigInstance, 0.0)
			Expect(err).NotTo(HaveOccurred())
			smallScore, err := emptyCell.ScoreForLRP(smallInstance, 0.0)
			Expect(err).NotTo(HaveOccurred())

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

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

		It("factors in disk usage", func() {
Beispiel #2
0
			*BuildLRP("pg-1", "domain", 0, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-1", "domain", 1, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-2", "domain", 0, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-3", "domain", 0, linuxRootFSURL, 10, 20),
			*BuildLRP("pg-4", "domain", 0, linuxRootFSURL, 10, 20),
		})
		cell = auctionrunner.NewCell(logger, "the-cell", client, state)
	})

	Describe("ScoreForLRP", func() {
		It("factors in memory usage", func() {
			bigInstance := BuildLRP("pg-big", "domain", 0, linuxRootFSURL, 20, 10)
			smallInstance := BuildLRP("pg-small", "domain", 0, linuxRootFSURL, 10, 10)

			By("factoring in the amount of memory taken up by the instance")
			bigScore, err := emptyCell.ScoreForLRP(bigInstance)
			Expect(err).NotTo(HaveOccurred())
			smallScore, err := emptyCell.ScoreForLRP(smallInstance)
			Expect(err).NotTo(HaveOccurred())

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

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

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