本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/models.NewPortMapping函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPortMapping函数的具体用法?Golang NewPortMapping怎么用?Golang NewPortMapping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewPortMapping函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ActualLRPNetInfoFromContainer
func ActualLRPNetInfoFromContainer(container executor.Container) (*models.ActualLRPNetInfo, error) {
ports := []*models.PortMapping{}
for _, portMapping := range container.Ports {
ports = append(ports, models.NewPortMapping(uint32(portMapping.HostPort), uint32(portMapping.ContainerPort)))
}
actualLRPNetInfo := models.NewActualLRPNetInfo(container.ExternalIP, ports...)
err := actualLRPNetInfo.Validate()
if err != nil {
return nil, err
}
return &actualLRPNetInfo, nil
}
开发者ID:jianhuiz,项目名称:rep,代码行数:15,代码来源:conversion_helpers.go
示例2: NewValidActualLRP
func NewValidActualLRP(guid string, index int32) *models.ActualLRP {
actualLRP := &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(guid, index, "some-domain"),
ActualLRPInstanceKey: models.NewActualLRPInstanceKey("some-guid", "some-cell"),
ActualLRPNetInfo: models.NewActualLRPNetInfo("some-address", models.NewPortMapping(2222, 4444)),
CrashCount: 33,
CrashReason: "badness",
State: models.ActualLRPStateRunning,
Since: 1138,
ModificationTag: models.ModificationTag{
Epoch: "some-epoch",
Index: 999,
},
}
err := actualLRP.Validate()
Expect(err).NotTo(HaveOccurred())
return actualLRP
}
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:19,代码来源:constructors.go
示例3:
logger = lager.NewLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
responseRecorder = httptest.NewRecorder()
handler = handlers.NewActualLRPHandler(fakeBBS, fakeLegacyBBS, logger)
actualLRP1 = models.NewRunningActualLRP(
models.NewActualLRPKey(
"process-guid-0",
1,
"domain-0",
),
models.NewActualLRPInstanceKey(
"instance-guid-0",
"cell-id-0",
),
models.NewActualLRPNetInfo("1.1.1.1", models.NewPortMapping(80, 5050)),
1138,
)
actualLRP2 = models.NewClaimedActualLRP(
models.NewActualLRPKey(
"process-guid-1",
2,
"domain-1",
),
models.NewActualLRPInstanceKey(
"instance-guid-1",
"cell-id-1",
),
4444,
)
开发者ID:rowhit,项目名称:lattice,代码行数:31,代码来源:actual_lrp_handlers_test.go
示例4:
Describe("Process", func() {
const sessionPrefix = "test.ordinary-lrp-processor."
var (
desiredLRP *models.DesiredLRP
expectedLrpKey models.ActualLRPKey
expectedInstanceKey models.ActualLRPInstanceKey
expectedNetInfo models.ActualLRPNetInfo
expectedSessionName string
)
BeforeEach(func() {
desiredLRP = model_helpers.NewValidDesiredLRP("process-guid")
expectedLrpKey = models.NewActualLRPKey("process-guid", 2, "domain")
expectedInstanceKey = models.NewActualLRPInstanceKey("instance-guid", "cell-id")
expectedNetInfo = models.NewActualLRPNetInfo("1.2.3.4", models.NewPortMapping(61999, 8080))
})
Context("when given an LRP container", func() {
var container executor.Container
BeforeEach(func() {
container = newLRPContainer(expectedLrpKey, expectedInstanceKey, expectedNetInfo)
})
JustBeforeEach(func() {
processor.Process(logger, container)
})
Context("and the container is INVALID", func() {
BeforeEach(func() {
开发者ID:jianhuiz,项目名称:rep,代码行数:31,代码来源:ordinary_lrp_processor_test.go
示例5:
Expect(fakeContainerDelegate.DeleteContainerCallCount()).To(Equal(1))
_, actualContainerGuid := fakeContainerDelegate.DeleteContainerArgsForCall(0)
Expect(actualContainerGuid).To(Equal(container.Guid))
})
})
})
Context("when the container is Running", func() {
var lrpNetInfo models.ActualLRPNetInfo
BeforeEach(func() {
container.State = executor.StateRunning
externalIP := "executor-ip"
container.ExternalIP = externalIP
container.Ports = []executor.PortMapping{{ContainerPort: 1357, HostPort: 8642}}
lrpNetInfo = models.NewActualLRPNetInfo(externalIP, models.NewPortMapping(8642, 1357))
})
It("evacuates the lrp", func() {
Expect(fakeBBS.EvacuateRunningActualLRPCallCount()).To(Equal(1))
actualLRPKey, actualLRPContainerKey, actualLRPNetInfo, actualTTL := fakeBBS.EvacuateRunningActualLRPArgsForCall(0)
Expect(*actualLRPKey).To(Equal(lrpKey))
Expect(*actualLRPContainerKey).To(Equal(lrpInstanceKey))
Expect(*actualLRPNetInfo).To(Equal(lrpNetInfo))
Expect(actualTTL).To(Equal(uint64(evacuationTTL)))
})
Context("when the evacuation returns successfully", func() {
BeforeEach(func() {
fakeBBS.EvacuateRunningActualLRPReturns(true, nil)
})
开发者ID:jiangytcn,项目名称:rep,代码行数:31,代码来源:evacuation_lrp_processor_test.go
示例6:
dummyMessage = routing_table.RegistryMessageFor(dummyEndpoint, routing_table.Routes{Hostnames: []string{"baz.com"}, LogGuid: logGuid})
messagesToEmit = routing_table.MessagesToEmit{
RegistrationMessages: []routing_table.RegistryMessage{dummyMessage},
}
schedulingInfoResponse = &models.DesiredLRPSchedulingInfo{
DesiredLRPKey: models.NewDesiredLRPKey(processGuid, "domain", logGuid),
Routes: cfroutes.CFRoutes{{Hostnames: []string{"route-1", "route-2"}, Port: containerPort}}.RoutingInfo(),
}
actualResponses = []*models.ActualLRPGroup{
{
Instance: &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(processGuid, 1, "domain"),
ActualLRPInstanceKey: models.NewActualLRPInstanceKey(instanceGuid, "cell-id"),
ActualLRPNetInfo: models.NewActualLRPNetInfo(lrpHost, models.NewPortMapping(1234, containerPort)),
State: models.ActualLRPStateRunning,
},
},
{
Instance: &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey("", 1, ""),
State: models.ActualLRPStateUnclaimed,
},
},
}
bbsClient.DesiredLRPSchedulingInfosReturns([]*models.DesiredLRPSchedulingInfo{schedulingInfoResponse}, nil)
bbsClient.ActualLRPGroupsReturns(actualResponses, nil)
fakeMetricSender = fake_metrics_sender.NewFakeMetricSender()
开发者ID:emc-xchallenge,项目名称:route-emitter,代码行数:31,代码来源:syncer_test.go
示例7:
BeforeEach(func() {
bbsRunner = testrunner.New(bbsBinPath, bbsArgs)
bbsProcess = ginkgomon.Invoke(bbsRunner)
filter = models.ActualLRPFilter{}
expectedActualLRPGroups = []*models.ActualLRPGroup{}
actualActualLRPGroups = []*models.ActualLRPGroup{}
baseLRPKey = models.NewActualLRPKey(baseProcessGuid, baseIndex, baseDomain)
baseLRPInstanceKey = models.NewActualLRPInstanceKey(baseInstanceGuid, cellID)
evacuatingLRPInstanceKey = models.NewActualLRPInstanceKey(evacuatingInstanceGuid, cellID)
otherLRPKey = models.NewActualLRPKey(otherProcessGuid, otherIndex, otherDomain)
otherLRPInstanceKey = models.NewActualLRPInstanceKey(otherInstanceGuid, otherCellID)
netInfo = models.NewActualLRPNetInfo("127.0.0.1", models.NewPortMapping(8080, 80))
unclaimedLRPKey = models.NewActualLRPKey(unclaimedProcessGuid, unclaimedIndex, unclaimedDomain)
crashingLRPKey = models.NewActualLRPKey(crashingProcessGuid, crashingIndex, crashingDomain)
crashingLRPInstanceKey = models.NewActualLRPInstanceKey(crashingInstanceGuid, otherCellID)
baseLRP = &models.ActualLRP{
ActualLRPKey: baseLRPKey,
ActualLRPInstanceKey: baseLRPInstanceKey,
ActualLRPNetInfo: netInfo,
State: models.ActualLRPStateRunning,
Since: time.Now().UnixNano(),
}
evacuatingLRP = &models.ActualLRP{
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:31,代码来源:actual_lrp_test.go
示例8:
netInfo models.ActualLRPNetInfo
requestBody interface{}
)
BeforeEach(func() {
key = models.NewActualLRPKey(
processGuid,
index,
"domain-0",
)
instanceKey = models.NewActualLRPInstanceKey(
"instance-guid-0",
"cell-id-0",
)
netInfo = models.NewActualLRPNetInfo("1.1.1.1", models.NewPortMapping(10, 20))
requestBody = &models.StartActualLRPRequest{
ActualLrpKey: &key,
ActualLrpInstanceKey: &instanceKey,
ActualLrpNetInfo: &netInfo,
}
actualLRP = models.ActualLRP{
ActualLRPKey: key,
State: models.ActualLRPStateUnclaimed,
Since: 1138,
}
})
JustBeforeEach(func() {
request := newTestRequest(requestBody)
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:31,代码来源:actual_lrp_lifecycle_handler_test.go
示例9:
diegoSSHRouteMessage := json.RawMessage(diegoSSHRoutePayload)
desiredLRP = &models.DesiredLRP{
ProcessGuid: "some-guid",
Instances: 2,
Routes: &models.Routes{
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)
开发者ID:benjaminharnett,项目名称:diego-ssh,代码行数:30,代码来源:permissions_builder_test.go
示例10:
Context("when a create event occurs", func() {
var (
actualLRPGroup *models.ActualLRPGroup
actualLRP *models.ActualLRP
actualLRPRoutingInfo *routing_table.ActualLRPRoutingInfo
)
Context("when the resulting LRP is in the RUNNING state", func() {
BeforeEach(func() {
actualLRP = &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(expectedProcessGuid, 1, "domain"),
ActualLRPInstanceKey: models.NewActualLRPInstanceKey(expectedInstanceGuid, "cell-id"),
ActualLRPNetInfo: models.NewActualLRPNetInfo(
expectedHost,
models.NewPortMapping(expectedExternalPort, expectedContainerPort),
models.NewPortMapping(expectedExternalPort, expectedAdditionalContainerPort),
),
State: models.ActualLRPStateRunning,
}
actualLRPGroup = &models.ActualLRPGroup{
Instance: actualLRP,
}
actualLRPRoutingInfo = &routing_table.ActualLRPRoutingInfo{
ActualLRP: actualLRP,
Evacuating: false,
}
})
开发者ID:emc-xchallenge,项目名称:route-emitter,代码行数:29,代码来源:watcher_test.go
示例11:
listener.Signal(os.Kill)
Eventually(listener.Wait()).Should(Receive())
}
})
Describe("GET /v1/actual_lrps/:guid", func() {
Context("when the bbs is running", func() {
JustBeforeEach(func() {
instanceKey0 := models.NewActualLRPInstanceKey("some-instance-guid-0", "cell-id")
err := bbsClient.ClaimActualLRP("some-process-guid", 0, &instanceKey0)
Expect(err).NotTo(HaveOccurred())
lrpKey1 := models.NewActualLRPKey("some-process-guid", 1, "some-domain")
instanceKey1 := models.NewActualLRPInstanceKey("some-instance-guid-1", "cell-id")
netInfo := models.NewActualLRPNetInfo("1.2.3.4", models.NewPortMapping(65100, 8080))
err = bbsClient.StartActualLRP(&lrpKey1, &instanceKey1, &netInfo)
Expect(err).NotTo(HaveOccurred())
})
It("reports the state of the given process guid's instances", func() {
getLRPs, err := requestGenerator.CreateRequest(
tps.LRPStatus,
rata.Params{"guid": "some-process-guid"},
nil,
)
Expect(err).NotTo(HaveOccurred())
response, err := httpClient.Do(getLRPs)
Expect(err).NotTo(HaveOccurred())
开发者ID:emc-xchallenge,项目名称:tps,代码行数:30,代码来源:main_test.go
示例12:
var actualLRP *models.ActualLRP
BeforeEach(func() {
actualLRP = &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(
"process-guid-0",
3,
"some-domain",
),
ActualLRPInstanceKey: models.NewActualLRPInstanceKey(
"instance-guid-0",
"cell-id-0",
),
ActualLRPNetInfo: models.NewActualLRPNetInfo(
"address-0",
models.NewPortMapping(9876, 2345),
),
State: models.ActualLRPStateRunning,
CrashCount: 42,
Since: 99999999999,
ModificationTag: models.ModificationTag{
Epoch: "some-guid",
Index: 50,
},
}
})
It("serializes all the fields", func() {
expectedResponse := receptor.ActualLRPResponse{
ProcessGuid: "process-guid-0",
InstanceGuid: "instance-guid-0",
开发者ID:davidwadden,项目名称:lattice-release,代码行数:31,代码来源:actual_lrps_test.go
示例13:
BeforeEach(func() {
receptorProcess = ginkgomon.Invoke(receptorRunner)
for i := 0; i < lrpCount; i++ {
index := strconv.Itoa(i)
lrpKey := models.NewActualLRPKey(
"process-guid-"+index,
int32(i),
fmt.Sprintf("domain-%d", i/2),
)
instanceKey := models.NewActualLRPInstanceKey(
"instance-guid-"+index,
"cell-id",
)
netInfo := models.NewActualLRPNetInfo("the-host", models.NewPortMapping(uint32(1000+i), 80))
_, err := bbsClient.StartActualLRP(&lrpKey, &instanceKey, &netInfo)
Expect(err).NotTo(HaveOccurred())
}
desiredLRP := oldmodels.DesiredLRP{
ProcessGuid: "process-guid-0",
Domain: "domain-0",
Instances: 1,
RootFS: "some:rootfs",
Ports: []uint16{80},
Action: &oldmodels.RunAction{User: "me", Path: "/bin/true"},
}
err := legacyBBS.DesireLRP(logger, desiredLRP)
Expect(err).NotTo(HaveOccurred())
开发者ID:davidwadden,项目名称:lattice-release,代码行数:30,代码来源:actual_lrp_test.go
示例14:
ProcessGuid: processGuid,
Domain: "domain",
Instances: 1,
RootFs: "some:rootfs",
Action: models.WrapAction(&models.RunAction{Path: "/bin/true", User: "name"}),
}
index int32 = 0
lrpKey = models.NewActualLRPKey(desiredLRP.ProcessGuid, index, desiredLRP.Domain)
alphaInstanceKey = models.NewActualLRPInstanceKey(alphaInstanceGuid, alphaCellID)
betaInstanceKey = models.NewActualLRPInstanceKey(betaInstanceGuid, betaCellID)
omegaInstanceKey = models.NewActualLRPInstanceKey(omegaInstanceGuid, omegaCellID)
emptyInstanceKey = models.ActualLRPInstanceKey{}
alphaPorts = models.NewPortMapping(9872, 2349)
alphaNetInfo = models.NewActualLRPNetInfo(alphaAddress, alphaPorts)
betaPorts = models.NewPortMapping(9868, 2353)
betaNetInfo = models.NewActualLRPNetInfo(betaAddress, betaPorts)
omegaPorts = models.NewPortMapping(9876, 2345)
omegaNetInfo = models.NewActualLRPNetInfo(omegaAddress, omegaPorts)
emptyNetInfo = models.EmptyActualLRPNetInfo()
)
type testable interface {
Test()
}
type evacuationTest struct {
Name string
Subject func() (bool, error)
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:31,代码来源:evacuation_db_test.go
示例15:
It("persists the evacuating lrp in etcd", func() {
group, err := etcdDB.EvacuateActualLRP(logger, &actualLRP.ActualLRPKey, &actualLRP.ActualLRPInstanceKey, &actualLRP.ActualLRPNetInfo, ttl)
Expect(err).NotTo(HaveOccurred())
actualLRP.ModificationTag.Increment()
actualLRPGroup, err := etcdDB.ActualLRPGroupByProcessGuidAndIndex(logger, guid, index)
Expect(err).NotTo(HaveOccurred())
Expect(actualLRPGroup.Evacuating).To(BeEquivalentTo(actualLRP))
Expect(group).To(Equal(actualLRPGroup))
})
})
Context("when the netinfo changes", func() {
BeforeEach(func() {
actualLRP.ActualLRPNetInfo.Ports = []*models.PortMapping{
models.NewPortMapping(6666, 7777),
}
})
It("persists the evacuating lrp in etcd", func() {
group, err := etcdDB.EvacuateActualLRP(logger, &actualLRP.ActualLRPKey, &actualLRP.ActualLRPInstanceKey, &actualLRP.ActualLRPNetInfo, ttl)
Expect(err).NotTo(HaveOccurred())
actualLRP.ModificationTag.Increment()
actualLRPGroup, err := etcdDB.ActualLRPGroupByProcessGuidAndIndex(logger, guid, index)
Expect(err).NotTo(HaveOccurred())
Expect(actualLRPGroup.Evacuating).To(BeEquivalentTo(actualLRP))
Expect(group).To(Equal(actualLRPGroup))
})
})
开发者ID:timani,项目名称:bbs,代码行数:30,代码来源:evacuation_db_test.go
示例16:
"index": 2,
"state": "RUNNING",
"since": 1138,
"cell_id":"some-cell-id",
"domain":"some-domain",
"crash_count": 1,
"modification_tag": {
"epoch": "some-guid",
"index": 50
}
}`
BeforeEach(func() {
lrpKey = models.NewActualLRPKey("some-guid", 2, "some-domain")
instanceKey = models.NewActualLRPInstanceKey("some-instance-guid", "some-cell-id")
netInfo = models.NewActualLRPNetInfo("1.2.3.4", models.NewPortMapping(5678, 8080), models.NewPortMapping(1234, 8081))
lrp = models.ActualLRP{
ActualLRPKey: lrpKey,
ActualLRPInstanceKey: instanceKey,
ActualLRPNetInfo: netInfo,
CrashCount: 1,
State: models.ActualLRPStateRunning,
Since: 1138,
ModificationTag: models.ModificationTag{
Epoch: "some-guid",
Index: 50,
},
}
})
开发者ID:rowhit,项目名称:lattice,代码行数:30,代码来源:actual_lrp_test.go
示例17:
evacuatingLRP *models.ActualLRP
otherDomainLRP *models.ActualLRP
otherCellIdLRP *models.ActualLRP
baseLRPKey models.ActualLRPKey
baseLRPInstanceKey models.ActualLRPInstanceKey
otherLRPInstanceKey models.ActualLRPInstanceKey
netInfo models.ActualLRPNetInfo
)
BeforeEach(func() {
baseLRPKey = models.NewActualLRPKey(baseProcessGuid, baseIndex, baseDomain)
baseLRPInstanceKey = models.NewActualLRPInstanceKey(baseInstanceGuid, cellID)
otherLRPInstanceKey = models.NewActualLRPInstanceKey(otherInstanceGuid, otherCellID)
netInfo = models.NewActualLRPNetInfo("127.0.0.1", models.NewPortMapping(8080, 80))
baseLRP = &models.ActualLRP{
ActualLRPKey: baseLRPKey,
ActualLRPInstanceKey: baseLRPInstanceKey,
ActualLRPNetInfo: netInfo,
State: models.ActualLRPStateRunning,
Since: clock.Now().UnixNano(),
}
evacuatingLRP = &models.ActualLRP{
ActualLRPKey: baseLRPKey,
ActualLRPInstanceKey: models.NewActualLRPInstanceKey(evacuatingInstanceGuid, cellID),
ActualLRPNetInfo: netInfo,
State: models.ActualLRPStateRunning,
Since: clock.Now().UnixNano() - 1000,
开发者ID:Gerg,项目名称:bbs,代码行数:31,代码来源:actual_lrp_db_test.go
示例18:
allowedCiphers = ""
allowedMACs = ""
allowedKeyExchanges = ""
expectedGetActualLRPRequest = &models.ActualLRPGroupByProcessGuidAndIndexRequest{
ProcessGuid: processGuid,
Index: 99,
}
actualLRPGroupResponse = &models.ActualLRPGroupResponse{
Error: nil,
ActualLrpGroup: &models.ActualLRPGroup{
Instance: &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey(processGuid, 99, "some-domain"),
ActualLRPInstanceKey: models.NewActualLRPInstanceKey("some-instance-guid", "some-cell-id"),
ActualLRPNetInfo: models.NewActualLRPNetInfo("127.0.0.1", models.NewPortMapping(uint32(sshdPort), 9999)),
},
},
}
getDesiredLRPRequest = &models.DesiredLRPByProcessGuidRequest{
ProcessGuid: processGuid,
}
sshRoute, err := json.Marshal(routes.SSHRoute{
ContainerPort: 9999,
PrivateKey: privateKeyPem,
HostFingerprint: hostKeyFingerprint,
})
Expect(err).NotTo(HaveOccurred())
开发者ID:swisscom,项目名称:diego-ssh,代码行数:30,代码来源:main_test.go
示例19:
It("should not be included in the results", func() {
routes := routing_table.RoutesByRoutingKeyFromSchedulingInfos([]*models.DesiredLRPSchedulingInfo{
{DesiredLRPKey: models.NewDesiredLRPKey("abc", "tests", "abc-guid"), Routes: nil},
})
Expect(routes).To(HaveLen(0))
})
})
})
Describe("EndpointsByRoutingKeyFromActuals", func() {
It("should build a map of endpoints, ignoring those without ports", func() {
endpoints := routing_table.EndpointsByRoutingKeyFromActuals([]*routing_table.ActualLRPRoutingInfo{
{
ActualLRP: &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey("abc", 0, "domain"),
ActualLRPNetInfo: models.NewActualLRPNetInfo("1.1.1.1", models.NewPortMapping(11, 44), models.NewPortMapping(66, 99)),
},
},
{
ActualLRP: &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey("abc", 1, "domain"),
ActualLRPNetInfo: models.NewActualLRPNetInfo("2.2.2.2", models.NewPortMapping(22, 44), models.NewPortMapping(88, 99)),
},
},
{
ActualLRP: &models.ActualLRP{
ActualLRPKey: models.NewActualLRPKey("def", 0, "domain"),
ActualLRPNetInfo: models.NewActualLRPNetInfo("3.3.3.3", models.NewPortMapping(33, 55)),
},
},
{
开发者ID:emc-xchallenge,项目名称:route-emitter,代码行数:31,代码来源:by_routing_key_test.go
示例20:
ghttp.RespondWithJSONEncoded(http.StatusOK, map[string][]string{"handles": []string{containerGuid}}),
)
fakeGarden.RouteToHandler("GET", "/containers/bulk_info",
ghttp.RespondWithJSONEncoded(http.StatusOK,
map[string]garden.ContainerInfoEntry{
containerGuid: garden.ContainerInfoEntry{Info: containerInfo},
},
),
)
fakeGarden.RouteToHandler("DELETE", "/containers/"+containerGuid, ghttp.RespondWithJSONEncoded(http.StatusOK, &struct{}{}))
fakeGarden.RouteToHandler("GET", "/containers/"+containerGuid+"/info", ghttp.RespondWithJSONEncoded(http.StatusOK, containerInfo))
lrpKey = models.NewActualLRPKey(processGuid, index, domain)
lrpContainerKey = models.NewActualLRPInstanceKey(instanceGuid, cellID)
lrpNetInfo = models.NewActualLRPNetInfo(address, models.NewPortMapping(2589, 1470))
err := bbsClient.StartActualLRP(&lrpKey, &lrpContainerKey, &lrpNetInfo)
Expect(err).NotTo(HaveOccurred())
resp, err := http.Post(fmt.Sprintf("http://127.0.0.1:%d/evacuate", serverPort), "text/html", nil)
Expect(err).NotTo(HaveOccurred())
resp.Body.Close()
Expect(resp.StatusCode).To(Equal(http.StatusAccepted))
})
It("evacuates them", func() {
getEvacuatingLRP := func() *models.ActualLRP {
actualLRPGroup, err := bbsClient.ActualLRPGroupByProcessGuidAndIndex(processGuid, int(index))
Expect(err).NotTo(HaveOccurred())
开发者ID:emc-xchallenge,项目名称:rep,代码行数:30,代码来源:main_test.go
注:本文中的github.com/cloudfoundry-incubator/bbs/models.NewPortMapping函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论