本文整理汇总了Golang中github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner.ETCDClusterRunner.NodeURLS方法的典型用法代码示例。如果您正苦于以下问题:Golang ETCDClusterRunner.NodeURLS方法的具体用法?Golang ETCDClusterRunner.NodeURLS怎么用?Golang ETCDClusterRunner.NodeURLS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner.ETCDClusterRunner
的用法示例。
在下文中一共展示了ETCDClusterRunner.NodeURLS方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
bbsURL = &url.URL{
Scheme: "http",
Host: bbsAddress,
}
bbsClient = bbs.NewClient(bbsURL.String())
auctioneerServer = ghttp.NewServer()
auctioneerServer.UnhandledRequestStatusCode = http.StatusAccepted
auctioneerServer.AllowUnhandledRequests = true
bbsArgs = bbstestrunner.Args{
Address: bbsAddress,
AdvertiseURL: bbsURL.String(),
AuctioneerAddress: auctioneerServer.URL(),
EtcdCluster: strings.Join(etcdRunner.NodeURLS(), ","),
ConsulCluster: consulRunner.ConsulCluster(),
EncryptionKeys: []string{"label:key"},
ActiveKeyLabel: "label",
}
})
var _ = BeforeEach(func() {
etcdRunner.Start()
consulRunner.Start()
consulRunner.WaitUntilReady()
bbsRunner = bbstestrunner.New(bbsPath, bbsArgs)
bbsProcess = ginkgomon.Invoke(bbsRunner)
示例2:
etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001+config.GinkgoConfig.ParallelNode, 1, nil)
consulRunner = consulrunner.NewClusterRunner(
9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
1,
"http",
)
etcdRunner.Start()
bbsAddress := fmt.Sprintf("127.0.0.1:%d", 13000+GinkgoParallelNode())
bbsBinPath = string(payload)
bbsArgs = bbsrunner.Args{
Address: bbsAddress,
AdvertiseURL: "http://" + bbsAddress,
AuctioneerAddress: "some-address",
EtcdCluster: etcdRunner.NodeURLS()[0],
ConsulCluster: consulRunner.ConsulCluster(),
EncryptionKeys: []string{"label:key"},
ActiveKeyLabel: "label",
}
bbsClient = bbs.NewClient("http://" + bbsAddress)
consulRunner.Start()
consulRunner.WaitUntilReady()
})
var _ = SynchronizedAfterSuite(func() {
consulRunner.Stop()
etcdRunner.KillWithFire()
}, func() {
示例3: TestDB
func TestDB(t *testing.T) {
RegisterFailHandler(Fail)
etcdPort = 4001 + GinkgoParallelNode()
etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
etcdRunner.Start()
etcdClient = etcdRunner.Adapter()
RunSpecs(t, "DB Suite")
etcdRunner.Stop()
}
var _ = BeforeSuite(func() {
Expect(len(etcdRunner.NodeURLS())).Should(BeNumerically(">=", 1))
etcdVersionUrl := etcdRunner.NodeURLS()[0] + "/version"
resp, err := http.Get(etcdVersionUrl)
Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
Expect(err).ToNot(HaveOccurred())
// response body: {"etcdserver":"2.1.1","etcdcluster":"2.1.0"}
Expect(string(body)).To(ContainSubstring(etcdVersion))
})
var _ = BeforeEach(func() {
etcdRunner.Reset()
示例4:
)
BeforeSuite(func() {
localIP, _ = localip.LocalIP()
etcdPort := 5500 + ginkgoConfig.GinkgoConfig.ParallelNode*10
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
etcdRunner.Start()
etcdAdapter = etcdRunner.Adapter(nil)
conf = config.Config{
JobName: "doppler_z1",
Index: "0",
EtcdMaxConcurrentRequests: 10,
EtcdUrls: etcdRunner.NodeURLS(),
Zone: "z1",
IncomingUDPPort: 1234,
IncomingTCPPort: 5678,
OutgoingPort: 8888,
}
})
AfterSuite(func() {
etcdAdapter.Disconnect()
etcdRunner.Stop()
})
var stopChan chan chan bool
BeforeEach(func() {
etcdRunner.Reset()
示例5:
routingAPIBinPath = string(routingAPIBin)
SetDefaultEventuallyTimeout(15 * time.Second)
},
)
var _ = SynchronizedAfterSuite(func() {}, func() {
gexec.CleanupBuildArtifacts()
})
var _ = BeforeEach(func() {
etcdPort = 4001 + GinkgoParallelNode()
etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
etcdRunner.Start()
etcdVersionUrl := etcdRunner.NodeURLS()[0] + "/version"
resp, err := http.Get(etcdVersionUrl)
Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
Expect(err).ToNot(HaveOccurred())
// response body: {"etcdserver":"2.1.1","etcdcluster":"2.1.0"}
Expect(string(body)).To(ContainSubstring(etcdVersion))
etcdAdapter = etcdRunner.Adapter(nil)
routingAPIPort = uint16(6900 + GinkgoParallelNode())
routingAPIIP = "127.0.0.1"
routingAPISystemDomain = "example.com"
routingAPIAddress = fmt.Sprintf("%s:%d", routingAPIIP, routingAPIPort)