예제 #1
0
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)
}
예제 #2
0
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)
}
예제 #3
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)
}
예제 #4
0
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)
}
예제 #5
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)
}
예제 #6
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)
}