コード例 #1
0
func handleDelete(receptorClient receptor.Client) {
	if *processGuid == "" {
		logger.Fatal("missing-processGuid", errors.New("Missing mandatory processGuid parameter for delete action"))
	}

	err := receptorClient.DeleteDesiredLRP(*processGuid)
	if err != nil {
		logger.Error("failed-to-delete", err, lager.Data{"process-guid": *processGuid})
		return
	}
	fmt.Printf("Desired LRP successfully deleted for process guid %s\n", *processGuid)
}
コード例 #2
0
			receptorClient = receptor.NewClient(routerApiConfig.DiegoAPIURL)

			externalPort = 62000 + GinkgoParallelNode()
			sampleReceiverPort1 = 8000 + GinkgoParallelNode()
			serverId1 = fmt.Sprintf("serverId-%d", GinkgoParallelNode())

			lrp := helpers.CreateDesiredLRP(logger,
				uint16(externalPort), uint16(sampleReceiverPort1), serverId1, 1)

			err := receptorClient.CreateDesiredLRP(lrp)
			Expect(err).ShouldNot(HaveOccurred())
			processGuid = lrp.ProcessGuid
		})

		AfterEach(func() {
			err := receptorClient.DeleteDesiredLRP(processGuid)
			Expect(err).ShouldNot(HaveOccurred())
		})

		It("receives TCP traffic on desired external port", func() {
			verifyConnection(externalPort, serverId1)

			By("updating LRP with new external port it receives traffic on new external port")
			externalPort = 63000 + GinkgoParallelNode()
			updatedLrp := helpers.UpdateDesiredLRP(uint16(externalPort),
				uint16(sampleReceiverPort1), 1)
			err := receptorClient.UpdateDesiredLRP(processGuid, updatedLrp)
			Expect(err).ShouldNot(HaveOccurred())
			verifyConnection(externalPort, serverId1)
		})
	})