本文整理匯總了Golang中github.com/elastic/beats/libbeat/outputs/mode/modetest.TestMode函數的典型用法代碼示例。如果您正苦於以下問題:Golang TestMode函數的具體用法?Golang TestMode怎麽用?Golang TestMode使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了TestMode函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestAsyncLBStartStop
func TestAsyncLBStartStop(t *testing.T) {
mode, _ := NewAsync(
[]mode.AsyncProtocolClient{},
1,
100*time.Millisecond,
100*time.Millisecond,
1*time.Second,
)
modetest.TestMode(t, mode, testNoOpts, nil, nil, nil)
}
示例2: testSingleSendFlakyGuaranteed
func testSingleSendFlakyGuaranteed(t *testing.T, events []modetest.EventInfo) {
var collected [][]outputs.Data
mode, _ := New(
modetest.NewMockClient(&modetest.MockClient{
CBPublish: modetest.PublishCollectAfterFailStart(25, &collected),
}),
3,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testGuaranteed, events, modetest.Signals(true), &collected)
}
示例3: testSingleSendFlakyFail
func testSingleSendFlakyFail(t *testing.T, events []modetest.EventInfo) {
var collected [][]common.MapStr
mode, _ := New(
modetest.NewMockClient(&modetest.MockClient{
CBPublish: modetest.PublishCollectAfterFailStart(3, &collected),
}),
3,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(false), &collected)
}
示例4: testSingleSendOneEvent
func testSingleSendOneEvent(t *testing.T, events []modetest.EventInfo) {
var collected [][]outputs.Data
mode, _ := New(
modetest.NewMockClient(&modetest.MockClient{
Connected: true,
CBPublish: modetest.PublishCollect(&collected),
}),
3,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例5: TestLoadBalancerStartStop
func TestLoadBalancerStartStop(t *testing.T) {
enableLogging([]string{"*"})
mode, _ := NewSync(
modetest.SyncClients(1, &modetest.MockClient{
Connected: false,
}),
1,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, nil, nil, nil)
}
示例6: testLoadBalancerOKSend
func testLoadBalancerOKSend(t *testing.T, events []modetest.EventInfo) {
var collected [][]outputs.Data
mode, _ := NewSync(
modetest.SyncClients(1, &modetest.MockClient{
Connected: false,
CBPublish: modetest.PublishCollect(&collected),
}),
2,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例7: testLoadBalancerFlakyGuaranteed
func testLoadBalancerFlakyGuaranteed(t *testing.T, events []modetest.EventInfo) {
var collected [][]common.MapStr
mode, _ := NewSync(
modetest.SyncClients(2, &modetest.MockClient{
Connected: true,
CBPublish: modetest.PublishCollectAfterFailStart(25, &collected),
}),
3,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testGuaranteed, events, modetest.Signals(true), &collected)
}
示例8: testLoadBalancerFlakyConnectionOkSend
func testLoadBalancerFlakyConnectionOkSend(t *testing.T, events []modetest.EventInfo) {
var collected [][]outputs.Data
mode, _ := NewSync(
modetest.SyncClients(2, &modetest.MockClient{
Connected: true,
CBPublish: modetest.PublishCollectAfterFailStart(1, &collected),
}),
3,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例9: testAsyncLBOKSend
func testAsyncLBOKSend(t *testing.T, events []modetest.EventInfo) {
enableLogging([]string{"*"})
var collected [][]common.MapStr
mode, _ := NewAsync(
modetest.AsyncClients(1, &modetest.MockClient{
CBAsyncPublish: modetest.AsyncPublishCollect(&collected),
}),
2,
100*time.Millisecond,
100*time.Millisecond,
1*time.Second,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例10: testAsyncLBFailSendWithoutActiveConnection
func testAsyncLBFailSendWithoutActiveConnection(t *testing.T, events []modetest.EventInfo) {
enableLogging([]string{"*"})
errFail := errors.New("fail connect")
mode, _ := NewAsync(
modetest.AsyncClients(2, &modetest.MockClient{
CBConnect: modetest.ConnectFail(errFail),
}),
2,
100*time.Millisecond,
100*time.Millisecond,
1*time.Second,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(false), nil)
}
示例11: testAsyncLBTemporayFailure
func testAsyncLBTemporayFailure(t *testing.T, events []modetest.EventInfo) {
var collected [][]common.MapStr
mode, _ := NewAsync(
modetest.AsyncClients(1, &modetest.MockClient{
Connected: true,
CBAsyncPublish: modetest.AsyncPublishCollectAfterFailStartWith(
1, mode.ErrTempBulkFailure, &collected),
}),
3,
100*time.Millisecond,
100*time.Millisecond,
1*time.Second,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例12: testAsyncLBFlakyConnectionOkSend
func testAsyncLBFlakyConnectionOkSend(t *testing.T, events []modetest.EventInfo) {
var collected [][]common.MapStr
tmpl := &modetest.MockClient{
Connected: true,
CBAsyncPublish: modetest.AsyncPublishCollectAfterFailStart(1, &collected),
}
mode, _ := NewAsync(
modetest.AsyncClients(2, tmpl),
3,
100*time.Millisecond,
100*time.Millisecond,
1*time.Second,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例13: testLoadBalancerTempFlakyInfAttempts
func testLoadBalancerTempFlakyInfAttempts(t *testing.T, events []modetest.EventInfo) {
var collected [][]common.MapStr
err := mode.ErrTempBulkFailure
mode, _ := NewSync(
modetest.SyncClients(2, &modetest.MockClient{
Connected: true,
CBPublish: modetest.PublishCollectAfterFailStartWith(25, err, &collected),
}),
0,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例14: testSingleSendFlakyInfAttempts
func testSingleSendFlakyInfAttempts(t *testing.T, events []modetest.EventInfo) {
enableLogging([]string{"*"})
var collected [][]outputs.Data
mode, _ := New(
modetest.NewMockClient(&modetest.MockClient{
CBPublish: modetest.PublishCollectAfterFailStart(25, &collected),
}),
0, // infinite number of send attempts
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
示例15: testLoadBalancerTempFlakyGuaranteed
func testLoadBalancerTempFlakyGuaranteed(t *testing.T, events []modetest.EventInfo) {
var collected [][]outputs.Data
err := mode.ErrTempBulkFailure
mode, _ := NewSync(
modetest.SyncClients(2, &modetest.MockClient{
Connected: true,
CBPublish: modetest.PublishCollectAfterFailStartWith(25, err, &collected),
}),
3,
1*time.Millisecond,
1*time.Millisecond,
10*time.Millisecond,
)
modetest.TestMode(t, mode, testGuaranteed, events, modetest.Signals(true), &collected)
}