本文整理汇总了Golang中github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner.ETCDClusterRunner.Adapter方法的典型用法代码示例。如果您正苦于以下问题:Golang ETCDClusterRunner.Adapter方法的具体用法?Golang ETCDClusterRunner.Adapter怎么用?Golang ETCDClusterRunner.Adapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner.ETCDClusterRunner
的用法示例。
在下文中一共展示了ETCDClusterRunner.Adapter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
binaries := map[string]string{}
err := json.Unmarshal(payload, &binaries)
Expect(err).NotTo(HaveOccurred())
etcdPort = 5001 + GinkgoParallelNode()
listenerPort = 1518 + GinkgoParallelNode()
trafficControllerPort = 7001 + GinkgoParallelNode()*2
trafficControllerAddress = fmt.Sprintf("127.0.0.1:%d", trafficControllerPort)
trafficControllerURL = fmt.Sprintf("ws://%s", trafficControllerAddress)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
listenerPath = string(binaries["listener"])
store = etcdRunner.Adapter(nil)
consulRunner = consulrunner.NewClusterRunner(
9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
1,
"http",
)
logger = lagertest.NewTestLogger("test")
bbsPath = string(binaries["bbs"])
bbsAddress := fmt.Sprintf("127.0.0.1:%d", 13000+GinkgoParallelNode())
bbsURL = &url.URL{
Scheme: "http",
Host: bbsAddress,
示例2: TestTrafficcontroller
. "github.com/onsi/gomega"
"testing"
)
var etcdRunner *etcdstorerunner.ETCDClusterRunner
var etcdPort int
var _ = BeforeSuite(func() {
etcdPort = 5800 + (config.GinkgoConfig.ParallelNode-1)*10
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
etcdRunner.Start()
})
var _ = AfterSuite(func() {
etcdRunner.Adapter().Disconnect()
etcdRunner.Stop()
})
func TestTrafficcontroller(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Trafficcontroller Suite")
}
var _ = BeforeEach(func() {
adapter := etcdRunner.Adapter()
adapter.Disconnect()
etcdRunner.Reset()
adapter.Connect()
示例3:
command := exec.Command(pathToMetronExecutable, "--config=fixtures/metron.json", "--debug")
metronSession, err = gexec.Start(command, gexec.NewPrefixedWriter("[o][metron]", GinkgoWriter), gexec.NewPrefixedWriter("[e][metron]", GinkgoWriter))
Expect(err).ShouldNot(HaveOccurred())
pathToStatsdInjectorExecutable, err := gexec.Build("statsd-injector")
Expect(err).NotTo(HaveOccurred())
command = exec.Command(pathToStatsdInjectorExecutable, "-statsdPort=51162", "-metronPort=51161", "-logLevel=debug")
statsdInjectorSession, err = gexec.Start(command, gexec.NewPrefixedWriter("[o][statsdInjector]", GinkgoWriter), gexec.NewPrefixedWriter("[e][statsdInjector]", GinkgoWriter))
Expect(err).ShouldNot(HaveOccurred())
localIPAddress, _ = localip.LocalIP()
etcdPort = 5800 + (config.GinkgoConfig.ParallelNode-1)*10
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
etcdRunner.Start()
Eventually(metronSession, 1).Should(gbytes.Say("metron started"))
Eventually(statsdInjectorSession).Should(gbytes.Say("Listening for statsd on host :51162"))
})
var _ = AfterSuite(func() {
metronSession.Kill().Wait()
statsdInjectorSession.Kill().Wait()
gexec.CleanupBuildArtifacts()
etcdRunner.Adapter(nil).Disconnect()
etcdRunner.Stop()
})
示例4:
var _ = SynchronizedBeforeSuite(func() []byte {
metronPath, err := gexec.Build("metron", "-race")
Expect(err).ShouldNot(HaveOccurred())
return []byte(metronPath)
}, func(path []byte) {
metronPath := string(path)
var err error
tmpdir, err = ioutil.TempDir("", "metronmetrics")
Expect(err).ShouldNot(HaveOccurred())
etcdPort := 5800 + (config.GinkgoConfig.ParallelNode)*10
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
etcdRunner.Start()
etcdAdapter = etcdRunner.Adapter(nil)
port := 51000 + config.GinkgoConfig.ParallelNode*10
metronRunner = &runners.MetronRunner{
Path: metronPath,
TempDir: tmpdir,
LegacyPort: port,
MetronPort: port + 1,
DropsondePort: 3457 + config.GinkgoConfig.ParallelNode*10,
EtcdRunner: etcdRunner,
}
})
var _ = SynchronizedAfterSuite(func() {
if etcdRunner != nil {
etcdRunner.Stop()
示例5:
dopplerSession *gexec.Session
localIPAddress string
etcdPort int
etcdRunner *etcdstorerunner.ETCDClusterRunner
etcdAdapter storeadapter.StoreAdapter
pathToDopplerExec string
pathToHTTPEchoServer string
pathToTCPEchoServer string
)
var _ = BeforeSuite(func() {
etcdPort = 5555
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
etcdRunner.Start()
etcdAdapter = etcdRunner.Adapter()
var err error
pathToDopplerExec, err = gexec.Build("doppler")
Expect(err).NotTo(HaveOccurred())
pathToHTTPEchoServer, err = gexec.Build("tools/httpechoserver")
Expect(err).NotTo(HaveOccurred())
pathToTCPEchoServer, err = gexec.Build("tools/tcpechoserver")
Expect(err).NotTo(HaveOccurred())
})
var _ = BeforeEach(func() {
var err error
示例6: TestDB
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestDB(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "DB Suite")
}
var etcdClient storeadapter.StoreAdapter
var etcdPort int
var etcdUrl string
var etcdRunner *etcdstorerunner.ETCDClusterRunner
var routingAPIBinPath string
var _ = BeforeEach(func() {
etcdPort = 4001 + GinkgoParallelNode()
etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
etcdRunner.Start()
etcdClient = etcdRunner.Adapter()
})
var _ = AfterEach(func() {
etcdClient.Disconnect()
etcdRunner.Stop()
})
示例7:
bytes, err := json.Marshal(BinPaths{
Converger: convergerBinPath,
Bbs: bbsBinPath,
})
Expect(err).NotTo(HaveOccurred())
return bytes
}, func(bytes []byte) {
binPaths = BinPaths{}
err := json.Unmarshal(bytes, &binPaths)
Expect(err).NotTo(HaveOccurred())
etcdPort := 5001 + config.GinkgoConfig.ParallelNode
etcdCluster := fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
etcdClient = etcdRunner.Adapter(nil)
consulRunner = consulrunner.NewClusterRunner(
9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
1,
"http",
)
logger = lagertest.NewTestLogger("test")
bbsAddress := fmt.Sprintf("127.0.0.1:%d", 13000+GinkgoParallelNode())
bbsURL := &url.URL{
Scheme: "http",
Host: bbsAddress,
}