當前位置: 首頁>>代碼示例>>Golang>>正文


Golang etcdstorerunner.NewETCDClusterRunner函數代碼示例

本文整理匯總了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)
}
開發者ID:vito,項目名稱:diego-sim,代碼行數:60,代碼來源:simulator.go

示例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())
}
開發者ID:philwhln,項目名稱:hm9000,代碼行數:9,代碼來源:mcat_coordinator_test.go

示例3: TestHM9000

func TestHM9000(t *testing.T) {
	RegisterFailHandler(Fail)

	etcdRunner = etcdstorerunner.NewETCDClusterRunner(5001, 1)
	etcdRunner.Start()

	RunSpecs(t, "HM9000 CLI Suite")

	etcdRunner.Stop()
}
開發者ID:KeyOfSpectator,項目名稱:hm9000,代碼行數:10,代碼來源:hm_suite_test.go

示例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()
}
開發者ID:nagyistge,項目名稱:hm9000,代碼行數:10,代碼來源:store_suite_test.go

示例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()
}
開發者ID:krumts,項目名稱:gorouter,代碼行數:13,代碼來源:db_suite_test.go

示例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())
}
開發者ID:nagyistge,項目名稱:hm9000,代碼行數:13,代碼來源:mcat_coordinator_test.go

示例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()
}
開發者ID:trainchou,項目名稱:gorouter,代碼行數:13,代碼來源:etcd_store_adapter_suite_test.go

示例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")
開發者ID:emc-xchallenge,項目名稱:bbs,代碼行數:31,代碼來源:etcd_suite_test.go

示例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],
開發者ID:jiangytcn,項目名稱:rep,代碼行數:31,代碼來源:internal_suite_test.go

示例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
開發者ID:Jonty,項目名稱:loggregator,代碼行數:30,代碼來源:integration_test_suite_test.go

示例11: setupEtcdAdapter

func setupEtcdAdapter() {
	etcdPort = 4001
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1, nil)
	etcdRunner.Start()
}
開發者ID:lyuyun,項目名稱:loggregator,代碼行數:5,代碼來源:integration_test_suite_test.go

示例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()
})
開發者ID:kei-yamazaki,項目名稱:loggregator,代碼行數:31,代碼來源:benchmark_suite_test.go

示例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()
開發者ID:cloudfoundry,項目名稱:benchmarkbbs,代碼行數:31,代碼來源:generator_suite_test.go

示例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()
})
開發者ID:cgrotz,項目名稱:hm9000,代碼行數:31,代碼來源:hm_suite_test.go


注:本文中的github.com/cloudfoundry/storeadapter/storerunner/etcdstorerunner.NewETCDClusterRunner函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。