Esempio n. 1
0
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)
}
Esempio n. 2
0
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)
}
Esempio n. 3
0
func testSingleConnectionFail(t *testing.T, events []modetest.EventInfo) {
	var collected [][]outputs.Data
	errFail := errors.New("fail connect")
	mode, _ := New(
		modetest.NewMockClient(&modetest.MockClient{
			Connected: false,
			CBConnect: modetest.ConnectFail(errFail),
			CBPublish: modetest.PublishCollect(&collected),
		}),
		3,
		1*time.Millisecond,
		1*time.Millisecond,
		10*time.Millisecond,
	)
	modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(false), &collected)
}
Esempio n. 4
0
func testSingleConnectFailConnectAndSend(t *testing.T, events []modetest.EventInfo) {
	var collected [][]common.MapStr
	errFail := errors.New("fail connect")
	mode, _ := New(
		modetest.NewMockClient(&modetest.MockClient{
			Connected: false,
			CBConnect: modetest.ConnectFailN(2, errFail),
			CBPublish: modetest.PublishCollect(&collected),
		}),
		3,
		1*time.Millisecond,
		1*time.Millisecond,
		10*time.Millisecond,
	)
	modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}