本文整理匯總了Golang中metron/writers/dopplerforwarder.DopplerForwarder類的典型用法代碼示例。如果您正苦於以下問題:Golang DopplerForwarder類的具體用法?Golang DopplerForwarder怎麽用?Golang DopplerForwarder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DopplerForwarder類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"github.com/cloudfoundry/loggregatorlib/loggregatorclient"
"time"
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DopplerForwarder", func() {
var (
clientPool *mockClientPool
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
)
BeforeEach(func() {
clientPool = &mockClientPool{}
logger = loggertesthelper.Logger()
forwarder = dopplerforwarder.New(clientPool, logger)
})
It("sends messages to a random doppler", func() {
message := []byte("Some message")
forwarder.Write(message)
Expect(clientPool.randomClient).ToNot(BeNil())
示例2:
"metron/writers/dopplerforwarder"
. "github.com/apoydence/eachers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/gosteno"
"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
)
var _ = Describe("DopplerForwarder", func() {
var (
clientPool *mockClientPool
client *mockClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
fakeWrapper *mockNetworkWrapper
message []byte
)
BeforeEach(func() {
message = []byte("I am a message!")
client = newMockClient()
clientPool = newMockClientPool()
clientPool.RandomClientOutput.Client <- client
close(clientPool.RandomClientOutput.Err)
logger = loggertesthelper.Logger()
loggertesthelper.TestLoggerSink.Clear()
示例3:
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/dropsonde/signature"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var sharedSecret = []byte("secret")
var _ = Describe("DopplerForwarder", func() {
var (
sender *fake.FakeMetricSender
clientPool *fakes.FakeClientPool
client *fakeclient.FakeClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
envelope *events.Envelope
)
BeforeEach(func() {
sender = fake.NewFakeMetricSender()
metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
client = &fakeclient.FakeClient{}
clientPool = &fakes.FakeClientPool{}
clientPool.RandomClientReturns(client, nil)
logger = loggertesthelper.Logger()
loggertesthelper.TestLoggerSink.Clear()
示例4:
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/dropsonde/signature"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var sharedSecret = []byte("secret")
var _ = Describe("DopplerForwarder", func() {
var (
sender *fake.FakeMetricSender
clientPool *fakes.FakeClientPool
client *fakeclient.FakeClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
envelope *events.Envelope
doneChan chan struct{}
bufferSize uint
)
BeforeEach(func() {
sender = fake.NewFakeMetricSender()
metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
client = &fakeclient.FakeClient{}
clientPool = &fakes.FakeClientPool{}
clientPool.RandomClientReturns(client, nil)
logger = loggertesthelper.Logger()
loggertesthelper.TestLoggerSink.Clear()
示例5:
"time"
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DopplerForwarder", func() {
var (
sender *fake.FakeMetricSender
clientPool *mockClientPool
client *mockClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
fakeWrapper *mockNetworkWrapper
message []byte
)
BeforeEach(func() {
message = []byte("I am a message!")
sender = fake.NewFakeMetricSender()
metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
client = newMockClient()
clientPool = newMockClientPool()
clientPool.RandomClientOutput.client <- client
close(clientPool.RandomClientOutput.err)