當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。