}) It("requires a valid CPU weight", func() { desiredLRP.CpuWeight = 101 assertDesiredLRPValidationFailsWithMessage(desiredLRP, "cpu_weight") }) It("limits the annotation length", func() { desiredLRP.Annotation = randStringBytes(50000) assertDesiredLRPValidationFailsWithMessage(desiredLRP, "annotation") }) Context("when security group is present", func() { It("must be valid", func() { desiredLRP.EgressRules = []*models.SecurityGroupRule{{ Protocol: "foo", }} assertDesiredLRPValidationFailsWithMessage(desiredLRP, "egress_rules") }) }) Context("when security group is not present", func() { It("does not error", func() { desiredLRP.EgressRules = []*models.SecurityGroupRule{} validationErr := desiredLRP.Validate() Expect(validationErr).NotTo(HaveOccurred()) }) }) Context("when cached dependencies are specified", func() {