Example #1
0
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)
}
Example #2
0
func testAsyncLBFlakyFail(t *testing.T, events []modetest.EventInfo) {
	enableLogging([]string{"*"})

	var collected [][]common.MapStr
	err := errors.New("flaky")
	mode, _ := NewAsync(
		modetest.AsyncClients(2, &modetest.MockClient{
			Connected:      true,
			CBAsyncPublish: modetest.AsyncPublishCollectAfterFailStartWith(3, err, &collected),
		}),
		3,
		100*time.Millisecond,
		100*time.Millisecond,
		1*time.Second,
	)
	modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(false), &collected)
}
Example #3
0
func testAsyncLBTempFlakyFail(t *testing.T, events []modetest.EventInfo) {
	enableLogging([]string{"*"})

	var collected [][]outputs.Data
	mode, _ := NewAsync(
		modetest.AsyncClients(2, &modetest.MockClient{
			Connected: true,
			CBAsyncPublish: modetest.AsyncPublishCollectAfterFailStartWith(
				6, mode.ErrTempBulkFailure, &collected),
		}),
		3,
		100*time.Millisecond,
		100*time.Millisecond,
		1*time.Second,
	)
	modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(false), &collected)
}
Example #4
0
func testAsyncLBFlakyInfAttempts2(t *testing.T, events []modetest.EventInfo) {
	if testing.Verbose() {
		logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"*"})
	}

	var collected [][]common.MapStr
	err := errors.New("flaky")
	mode, _ := NewAsync(
		modetest.AsyncClients(2, &modetest.MockClient{
			CBAsyncPublish: modetest.AsyncPublishCollectAfterFailStartWith(
				50, err, &collected),
		}),
		0,
		1*time.Nanosecond,
		1*time.Millisecond,
		4*time.Millisecond,
	)
	modetest.TestMode(t, mode, testNoOpts, events, modetest.Signals(true), &collected)
}
Example #5
0
func testAsyncLBFlakyGuaranteed2(t *testing.T, events []modetest.EventInfo) {
	if testing.Verbose() {
		logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"*"})
	}

	var collected [][]outputs.Data
	err := errors.New("flaky")
	tmpl := &modetest.MockClient{
		Connected:      true,
		CBAsyncPublish: modetest.AsyncPublishCollectAfterFailStartWith(50, err, &collected),
	}
	mode, _ := NewAsync(
		modetest.AsyncClients(2, tmpl),
		3,
		1*time.Nanosecond,
		1*time.Millisecond,
		4*time.Millisecond,
	)
	modetest.TestMode(t, mode, testGuaranteed, events, modetest.Signals(true), &collected)
}