Esempio n. 1
0
func newValidResource() models.DesiredLRPResource {
	return models.NewDesiredLRPResource(256, 256, "preloaded://linux64")
}
Esempio n. 2
0
var _ = Describe("DesiredLRPResource", func() {
	const rootFs = "preloaded://linux64"
	const memoryMb = 256
	const diskMb = 256

	DescribeTable("Validation",
		func(key models.DesiredLRPResource, expectedErr string) {
			err := key.Validate()
			if expectedErr == "" {
				Expect(err).NotTo(HaveOccurred())
			} else {
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring(expectedErr))
			}
		},
		Entry("valid resource", models.NewDesiredLRPResource(memoryMb, diskMb, rootFs), ""),
		Entry("invalid rootFs", models.NewDesiredLRPResource(memoryMb, diskMb, "BAD URL"), "rootfs"),
		Entry("invalid memoryMb", models.NewDesiredLRPResource(-1, diskMb, rootFs), "memory_mb"),
		Entry("invalid diskMb", models.NewDesiredLRPResource(memoryMb, -1, rootFs), "disk_mb"),
	)
})

var _ = Describe("DesiredLRPSchedulingInfo", func() {
	const annotation = "the annotation"
	const instances = 2
	var (
		largeString = randStringBytes(50000)
		rawMessage  = json.RawMessage([]byte(`{"port": 8080,"hosts":["new-route-1","new-route-2"]}`))
		routes      = models.Routes{
			"router": &rawMessage,
		}