当前位置: 首页>>代码示例>>Golang>>正文


Golang FakeClient.DesiredLRPByProcessGuidReturns方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/fake_bbs.FakeClient.DesiredLRPByProcessGuidReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeClient.DesiredLRPByProcessGuidReturns方法的具体用法?Golang FakeClient.DesiredLRPByProcessGuidReturns怎么用?Golang FakeClient.DesiredLRPByProcessGuidReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/bbs/fake_bbs.FakeClient的用法示例。


在下文中一共展示了FakeClient.DesiredLRPByProcessGuidReturns方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

	Context("when the desired LRP does not exist", func() {
		var newlyDesiredLRP *models.DesiredLRP

		BeforeEach(func() {
			newlyDesiredLRP = &models.DesiredLRP{
				ProcessGuid: "new-process-guid",
				Instances:   1,
				RootFs:      models.PreloadedRootFS("stack-2"),
				Action: models.WrapAction(&models.RunAction{
					User: "me",
					Path: "ls",
				}),
				Annotation: "last-modified-etag",
			}

			fakeBBS.DesiredLRPByProcessGuidReturns(&models.DesiredLRP{}, models.ErrResourceNotFound)
			buildpackBuilder.BuildReturns(newlyDesiredLRP, nil)
		})

		It("logs the incoming and outgoing request", func() {
			Eventually(logger.TestSink.Buffer).Should(gbytes.Say("request-from-cc"))
			Eventually(logger.TestSink.Buffer).Should(gbytes.Say("creating-desired-lrp"))
		})

		It("creates the desired LRP", func() {
			Expect(fakeBBS.DesireLRPCallCount()).To(Equal(1))

			Expect(fakeBBS.DesiredLRPByProcessGuidCallCount()).To(Equal(1))
			Expect(fakeBBS.DesireLRPArgsForCall(0)).To(Equal(newlyDesiredLRP))

			Expect(buildpackBuilder.BuildArgsForCall(0)).To(Equal(&desireAppRequest))
开发者ID:cf-routing,项目名称:nsync,代码行数:31,代码来源:desire_app_handler_test.go

示例2:

		BeforeEach(func() {
			req = newTestRequest("")
			req.Form = url.Values{":process_guid": []string{"process-guid-0"}}
		})

		JustBeforeEach(func() {
			handler.Get(responseRecorder, req)
		})

		Context("when reading tasks from BBS succeeds", func() {
			BeforeEach(func() {
				fakeBBS.DesiredLRPByProcessGuidReturns(&models.DesiredLRP{
					ProcessGuid: "process-guid-0",
					Domain:      "domain-1",
					Action: models.WrapAction(&models.RunAction{
						User: "me",
						Path: "the-path",
					}),
				}, nil)
			})

			It("calls DesiredLRPByProcessGuid on the BBS", func() {
				Expect(fakeBBS.DesiredLRPByProcessGuidCallCount()).To(Equal(1))
				actualProcessGuid := fakeBBS.DesiredLRPByProcessGuidArgsForCall(0)
				Expect(actualProcessGuid).To(Equal("process-guid-0"))
			})

			It("responds with 200 Status OK", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
			})
开发者ID:davidwadden,项目名称:lattice-release,代码行数:30,代码来源:desired_lrp_handlers_test.go

示例3:

					routes.DIEGO_SSH: &diegoSSHRouteMessage,
				},
				LogGuid: "log-guid",
			}

			actualLRPGroup = &models.ActualLRPGroup{
				Instance: &models.ActualLRP{
					ActualLRPKey:         models.NewActualLRPKey("some-guid", 1, "some-domain"),
					ActualLRPInstanceKey: models.NewActualLRPInstanceKey("some-instance-guid", "some-cell-id"),
					ActualLRPNetInfo:     models.NewActualLRPNetInfo("1.2.3.4", models.NewPortMapping(3333, 1111)),
				},
			}

			bbsClient = new(fake_bbs.FakeClient)
			bbsClient.ActualLRPGroupByProcessGuidAndIndexReturns(actualLRPGroup, nil)
			bbsClient.DesiredLRPByProcessGuidReturns(desiredLRP, nil)

			credentials = []byte("some-user:some-password")
			permissionsBuilder = authenticators.NewPermissionsBuiler(bbsClient)

			remoteAddr, err := net.ResolveIPAddr("ip", "1.1.1.1")
			Expect(err).NotTo(HaveOccurred())
			metadata = &fake_ssh.FakeConnMetadata{}
			metadata.RemoteAddrReturns(remoteAddr)

			processGuid = "some-guid"
			index = 1
		})

		JustBeforeEach(func() {
			permissions, buildErr = permissionsBuilder.Build(processGuid, index, metadata)
开发者ID:benjaminharnett,项目名称:diego-ssh,代码行数:31,代码来源:permissions_builder_test.go

示例4:

			})

			Context("and the container is INVALID", func() {
				BeforeEach(func() {
					expectedSessionName = sessionPrefix + "process-invalid-container"
					container.State = executor.StateInvalid
				})

				It("logs an error", func() {
					Expect(logger).To(Say(expectedSessionName))
				})
			})

			Context("and the container is RESERVED", func() {
				BeforeEach(func() {
					bbsClient.DesiredLRPByProcessGuidReturns(desiredLRP, nil)
					expectedSessionName = sessionPrefix + "process-reserved-container"
					container.State = executor.StateReserved
				})

				It("claims the actualLRP in the bbs", func() {
					Expect(bbsClient.ClaimActualLRPCallCount()).To(Equal(1))
					processGuid, index, instanceKey := bbsClient.ClaimActualLRPArgsForCall(0)
					Expect(processGuid).To(Equal(expectedLrpKey.ProcessGuid))
					Expect(int32(index)).To(Equal(expectedLrpKey.Index))
					Expect(*instanceKey).To(Equal(expectedInstanceKey))
				})

				Context("when claiming fails because ErrActualLRPCannotBeClaimed", func() {
					BeforeEach(func() {
						bbsClient.ClaimActualLRPReturns(models.ErrActualLRPCannotBeClaimed)
开发者ID:jianhuiz,项目名称:rep,代码行数:31,代码来源:ordinary_lrp_processor_test.go

示例5:

			request.Header.Set("Authorization", authorization)
			request.Form = url.Values{}
			request.Form.Add(":guid", guid)

			noaaClient.ContainerMetricsReturns([]*events.ContainerMetric{
				{
					ApplicationId: proto.String("appId"),
					InstanceIndex: proto.Int32(5),
					CpuPercentage: proto.Float64(4),
					MemoryBytes:   proto.Uint64(1024),
					DiskBytes:     proto.Uint64(2048),
				},
			}, nil)

			bbsClient.DesiredLRPByProcessGuidReturns(&models.DesiredLRP{
				LogGuid:     logGuid,
				ProcessGuid: guid,
			}, nil)

			actualLRP := &models.ActualLRP{
				ActualLRPKey:         models.NewActualLRPKey(guid, 5, "some-domain"),
				ActualLRPInstanceKey: models.NewActualLRPInstanceKey("instanceId", "some-cell"),
				ActualLRPNetInfo: models.NewActualLRPNetInfo(
					"host",
					models.NewPortMapping(5432, 7890),
					models.NewPortMapping(1234, uint32(recipebuilder.DefaultPort)),
				),
				State: models.ActualLRPStateRunning,
				Since: fakeClock.Now().UnixNano(),
			}

			bbsClient.ActualLRPGroupsByProcessGuidReturns([]*models.ActualLRPGroup{{
开发者ID:emc-xchallenge,项目名称:tps,代码行数:32,代码来源:lrpstats_test.go


注:本文中的github.com/cloudfoundry-incubator/bbs/fake_bbs.FakeClient.DesiredLRPByProcessGuidReturns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。