本文整理匯總了Golang中github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner.NewETCDClusterRunner函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewETCDClusterRunner函數的具體用法?Golang NewETCDClusterRunner怎麽用?Golang NewETCDClusterRunner使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewETCDClusterRunner函數的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
flag.Parse()
//make the out dir
logger.Component = "SIMULATOR"
if outDir == "" {
logger.Fatal("out.dir.unspecified")
}
err := os.MkdirAll(outDir, 0777)
if err != nil {
logger.Fatal("out.dir.creation.failed", err)
}
//set up logging
outputFile, err := os.Create(filepath.Join(outDir, "simulator.log"))
if err != nil {
logger.Fatal("failed.to.create.simulator.log", err)
}
logger.Writer = io.MultiWriter(os.Stdout, outputFile)
cleanup.Register(func() {
outputFile.Sync()
})
//compile the executor
logger.Info("compiling.executor")
output, err := exec.Command("go", "install", "github.com/cloudfoundry-incubator/simulator/game_executor").CombinedOutput()
if err != nil {
logger.Fatal("failed.to.compile.executor", string(output))
}
//write info to the output dir
writeInfo()
//start etcd
logger.Info("starting.etcd", etcdNodes)
etcd = etcdstorerunner.NewETCDClusterRunner(4001, etcdNodes)
etcd.Start()
//set up the bbs
pool := workerpool.NewWorkerPool(50)
etcdAdapter = etcdstoreadapter.NewETCDStoreAdapter(etcd.NodeURLS(), pool)
etcdAdapter.Connect()
bbs = Bbs.New(etcdAdapter, timeprovider.NewTimeProvider())
//monitor etcd
monitorETCD()
//start executors
startExecutors()
cleanup.Register(func() {
logger.Info("stopping.etcd", etcdNodes)
etcd.Stop()
})
//run the simulator
runSimulation()
cleanup.Exit(0)
}
示例2: StartETCD
func (coordinator *MCATCoordinator) StartETCD() {
etcdPort := 5000 + (coordinator.ParallelNode-1)*10
coordinator.StoreRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
coordinator.StoreRunner.Start()
coordinator.StoreAdapter = etcdstoreadapter.NewETCDStoreAdapter(coordinator.StoreRunner.NodeURLS(), workerpool.NewWorkerPool(coordinator.Conf.StoreMaxConcurrentRequests))
err := coordinator.StoreAdapter.Connect()
Ω(err).ShouldNot(HaveOccurred())
}
示例3: TestHM9000
func TestHM9000(t *testing.T) {
RegisterFailHandler(Fail)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001, 1)
etcdRunner.Start()
RunSpecs(t, "HM9000 CLI Suite")
etcdRunner.Stop()
}
示例4: TestStore
func TestStore(t *testing.T) {
registerSignalHandler()
RegisterFailHandler(Fail)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001+config.GinkgoConfig.ParallelNode, 1, nil)
etcdRunner.Start()
RunSpecs(t, "Store Suite")
etcdRunner.Stop()
}
示例5: 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()
}
示例6: StartETCD
func (coordinator *MCATCoordinator) StartETCD() {
etcdPort := 5000 + (coordinator.ParallelNode-1)*10
coordinator.StoreRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
coordinator.StoreRunner.Start()
pool, err := workpool.NewWorkPool(coordinator.Conf.StoreMaxConcurrentRequests)
Expect(err).NotTo(HaveOccurred())
coordinator.StoreAdapter, err = etcdstoreadapter.New(&etcdstoreadapter.ETCDOptions{ClusterUrls: coordinator.StoreRunner.NodeURLS()}, pool)
Expect(err).NotTo(HaveOccurred())
err = coordinator.StoreAdapter.Connect()
Expect(err).NotTo(HaveOccurred())
}
示例7: TestStoreAdapter
func TestStoreAdapter(t *testing.T) {
registerSignalHandler()
RegisterFailHandler(Fail)
etcdPort := 5000 + (config.GinkgoConfig.ParallelNode-1)*10
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
etcdRunner.Start()
RunSpecs(t, "ETCD Store Adapter Suite")
stopStores()
}
示例8: TestDB
var etcdDBWithFakeStore db.DB
var workPoolCreateError error
var cryptor encryption.Cryptor
func TestDB(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "ETCD DB Suite")
}
var _ = BeforeSuite(func() {
clock = fakeclock.NewFakeClock(time.Unix(0, 1138))
etcdPort = 4001 + GinkgoParallelNode()
etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
consulRunner = consulrunner.NewClusterRunner(
9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
1,
"http",
)
consulRunner.Start()
consulRunner.WaitUntilReady()
etcdRunner.Start()
Expect(workPoolCreateError).ToNot(HaveOccurred())
encryptionKey, err := encryption.NewKey("label", "passphrase")
示例9: TestInternal
var bbsBinPath string
var bbsRunner *ginkgomon.Runner
var bbsProcess ifrit.Process
var bbsClient bbs.Client
func TestInternal(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Internal Suite")
}
var _ = SynchronizedBeforeSuite(func() []byte {
bbsBinPath, err := gexec.Build("github.com/cloudfoundry-incubator/bbs/cmd/bbs")
Expect(err).NotTo(HaveOccurred())
return []byte(bbsBinPath)
}, func(payload []byte) {
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],
示例10:
etcdRunner *etcdstorerunner.ETCDClusterRunner
etcdAdapter storeadapter.StoreAdapter
metronExecutablePath string
dopplerExecutablePath string
trafficControllerExecutablePath string
metronSession *gexec.Session
dopplerSession *gexec.Session
tcSession *gexec.Session
)
var _ = BeforeSuite(func() {
runtime.GOMAXPROCS(runtime.NumCPU())
etcdRunner = etcdstorerunner.NewETCDClusterRunner(49623, 1, nil)
etcdRunner.Start()
etcdAdapter = etcdRunner.Adapter(nil)
metronExecutablePath = buildComponent("metron")
dopplerExecutablePath = buildComponent("doppler")
trafficControllerExecutablePath = buildComponent("trafficcontroller")
// Wait for etcd to startup
waitOnURL("http://localhost:49623")
})
var _ = BeforeEach(func() {
const (
BLUE = 34
PURPLE = 35
LIGHT_BLUE = 36
示例11: setupEtcdAdapter
func setupEtcdAdapter() {
etcdPort = 4001
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
etcdRunner.Start()
}
示例12: TestBenchmark
)
func TestBenchmark(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Benchmark Suite")
}
var (
pathToMetronBenchmarkExec string
pathToMetronExecutable string
metronSession *gexec.Session
etcdRunner *etcdstorerunner.ETCDClusterRunner
)
var _ = BeforeSuite(func() {
etcdRunner = etcdstorerunner.NewETCDClusterRunner(4001, 1, nil)
etcdRunner.Start()
var err error
pathToMetronExecutable, err = gexec.Build("metron")
Expect(err).ToNot(HaveOccurred())
pathToMetronBenchmarkExec, err = gexec.Build("tools/metronbenchmark")
Expect(err).NotTo(HaveOccurred())
})
var _ = AfterSuite(func() {
gexec.CleanupBuildArtifacts()
etcdRunner.Adapter(nil).Disconnect()
etcdRunner.Stop()
})
示例13:
AuctioneerAddress: auctioneerServer.URL(),
MetricsReportInterval: 10 * time.Millisecond,
EncryptionKeys: []string{"label:key"},
ActiveKeyLabel: "label",
}
})
var _ = JustBeforeEach(func() {
etcdPort = 4001 + GinkgoParallelNode()
etcdScheme := "http"
if etcdSSLConfig != nil {
etcdScheme = "https"
}
etcdUrl = fmt.Sprintf(etcdScheme+"://127.0.0.1:%d", etcdPort)
etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, etcdSSLConfig)
consulRunner = consulrunner.NewClusterRunner(
9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
1,
"http",
)
consulRunner.Start()
consulRunner.WaitUntilReady()
consulRunner.Reset()
etcdRunner.Start()
etcdRunner.Reset()
etcdClient = etcdRunner.Client()
示例14: TestHM9000
. "github.com/onsi/gomega"
"github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner"
"testing"
)
var etcdRunner *etcdstorerunner.ETCDClusterRunner
func TestHM9000(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "HM9000 CLI Suite")
}
var _ = SynchronizedBeforeSuite(func() []byte {
etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001, 1)
etcdRunner.Start()
return nil
}, func([]byte) {
})
var _ = SynchronizedAfterSuite(func() {
etcdRunner.Stop()
}, func() {
})
var _ = BeforeEach(func() {
etcdRunner.Reset()
})