コード例 #1
0
			Expect(err).To(MatchError(ContainSubstring("unmarshal")))
		})
	})

	Describe("NewRunRequestFromDesiredLRP", func() {
		var (
			containerGuid string
			desiredLRP    *models.DesiredLRP
			actualLRP     *models.ActualLRP
		)

		BeforeEach(func() {
			containerGuid = "the-container-guid"
			desiredLRP = model_helpers.NewValidDesiredLRP("the-process-guid")
			actualLRP = model_helpers.NewValidActualLRP("the-process-guid", 9)
			desiredLRP.RootFs = "preloaded://foobar"
		})

		It("returns a valid run request", func() {
			runReq, err := rep.NewRunRequestFromDesiredLRP(containerGuid, desiredLRP, &actualLRP.ActualLRPKey, &actualLRP.ActualLRPInstanceKey)
			Expect(err).NotTo(HaveOccurred())
			Expect(runReq.Tags).To(Equal(executor.Tags{}))
			Expect(runReq.RunInfo).To(Equal(executor.RunInfo{
				CPUWeight: uint(desiredLRP.CpuWeight),
				DiskScope: executor.ExclusiveDiskLimit,
				Ports:     rep.ConvertPortMappings(desiredLRP.Ports),
				LogConfig: executor.LogConfig{
					Guid:       desiredLRP.LogGuid,
					Index:      int(actualLRP.Index),
					SourceName: desiredLRP.LogSource,
				},
コード例 #2
0
ファイル: desired_lrp_test.go プロジェクト: timani/bbs
			desiredLRP.Instances = 0
			validationErr := desiredLRP.Validate()
			Expect(validationErr).NotTo(HaveOccurred())

			desiredLRP.Instances = 1
			validationErr = desiredLRP.Validate()
			Expect(validationErr).NotTo(HaveOccurred())
		})

		It("requires a domain", func() {
			desiredLRP.Domain = ""
			assertDesiredLRPValidationFailsWithMessage(desiredLRP, "domain")
		})

		It("requires a rootfs", func() {
			desiredLRP.RootFs = ""
			assertDesiredLRPValidationFailsWithMessage(desiredLRP, "rootfs")
		})

		It("requires a valid URL with a non-empty scheme for the rootfs", func() {
			desiredLRP.RootFs = ":not-a-url"
			assertDesiredLRPValidationFailsWithMessage(desiredLRP, "rootfs")
		})

		It("requires a valid absolute URL for the rootfs", func() {
			desiredLRP.RootFs = "not-an-absolute-url"
			assertDesiredLRPValidationFailsWithMessage(desiredLRP, "rootfs")
		})

		It("requires an action", func() {
			desiredLRP.Action = nil