本文整理汇总了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)
}
示例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
示例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 (