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


Golang fake.NewFakeMetricSender函數代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/dropsonde/metric_sender/fake.NewFakeMetricSender函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewFakeMetricSender函數的具體用法?Golang NewFakeMetricSender怎麽用?Golang NewFakeMetricSender使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewFakeMetricSender函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: init

func init() {
	sender = metrics_fakes.NewFakeMetricSender()
	metrics.Initialize(sender, nil)
}
開發者ID:nagyistge,項目名稱:gorouter,代碼行數:4,代碼來源:route_fetcher_test.go

示例2:

	var port int
	var address string
	var fakeMetricSender *fake.FakeMetricSender

	BeforeEach(func() {
		port = 3456 + GinkgoParallelNode()
		address = net.JoinHostPort("127.0.0.1", strconv.Itoa(port))
		writer = mocks.MockByteArrayWriter{}
		reader = networkreader.New(address, "networkReader", &writer, loggertesthelper.Logger())
		readerStopped = make(chan struct{})
	})

	Context("with a reader running", func() {
		BeforeEach(func() {
			loggertesthelper.TestLoggerSink.Clear()
			fakeMetricSender = fake.NewFakeMetricSender()
			metricBatcher := metricbatcher.New(fakeMetricSender, time.Millisecond)
			metrics.Initialize(fakeMetricSender, metricBatcher)

			go func() {
				reader.Start()
				close(readerStopped)
			}()

			expectedLog := fmt.Sprintf("Listening on port %s", address)
			Eventually(loggertesthelper.TestLoggerSink.LogContents).Should(ContainSubstring(expectedLog))
		})

		AfterEach(func() {
			reader.Stop()
			<-readerStopped
開發者ID:jvshahid,項目名稱:loggregator,代碼行數:31,代碼來源:network_reader_test.go

示例3:

	var (
		fakeMetricSender *fake_metric_sender.FakeMetricSender

		logger          lager.Logger
		fakeDiegoClient *fake_bbs.FakeClient
		fakeCcClient    *fakes.FakeCcClient
		fakeBackend     *fake_backend.FakeBackend

		responseRecorder *httptest.ResponseRecorder
		handler          handlers.StagingHandler
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")

		fakeMetricSender = fake_metric_sender.NewFakeMetricSender()
		metrics.Initialize(fakeMetricSender, nil)

		fakeCcClient = &fakes.FakeCcClient{}

		fakeBackend = &fake_backend.FakeBackend{}
		fakeBackend.BuildRecipeReturns(&models.TaskDefinition{}, "", "", nil)

		fakeDiegoClient = &fake_bbs.FakeClient{}

		responseRecorder = httptest.NewRecorder()
		handler = handlers.NewStagingHandler(logger, map[string]backend.Backend{"fake-backend": fakeBackend}, fakeCcClient, fakeDiegoClient)
	})

	Describe("Stage", func() {
		var (
開發者ID:emc-xchallenge,項目名稱:stager,代碼行數:31,代碼來源:staging_handler_test.go


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