func newTestElasticsearchOutput(t *testing.T, test string) *testOutputer {
	plugin := outputs.FindOutputPlugin("elasticsearch")
	if plugin == nil {
		t.Fatalf("No elasticsearch output plugin found")
	}

	index := testElasticsearchIndex(test)
	connection := esConnect(t, index)

	flushInterval := 0
	bulkSize := 0
	config := outputs.MothershipConfig{
		Hosts:         []string{getElasticsearchHost()},
		Index:         index,
		FlushInterval: &flushInterval,
		BulkMaxSize:   &bulkSize,
		Username:      os.Getenv("ES_USER"),
		Password:      os.Getenv("ES_PASS"),
	}

	output, err := plugin.NewOutput("test", &config, 10)
	if err != nil {
		t.Fatalf("init elasticsearch output plugin failed: %v", err)
	}

	es := &testOutputer{}
	es.BulkOutputer = output.(outputs.BulkOutputer)
	es.esConnection = connection
	return es
}
func newTestLumberjackOutput(
	t *testing.T,
	test string,
	config *outputs.MothershipConfig,
) outputs.BulkOutputer {
	if config == nil {
		config = &outputs.MothershipConfig{
			TLS:   nil,
			Hosts: []string{getLogstashHost()},
			Index: testLogstashIndex(test),
		}

	}

	plugin := outputs.FindOutputPlugin("logstash")
	if plugin == nil {
		t.Fatalf("No logstash output plugin found")
	}

	output, err := plugin.NewOutput("test", config, 0)
	if err != nil {
		t.Fatalf("init logstash output plugin failed: %v", err)
	}

	return output.(outputs.BulkOutputer)
}
func newTestLumberjackOutput(
	t *testing.T,
	config outputs.MothershipConfig,
) outputs.Outputer {
	plugin := outputs.FindOutputPlugin("lumberjack")
	if plugin == nil {
		t.Fatalf("No lumberjack output plugin found")
	}

	output, err := plugin.NewOutput("test", &config, 0)
	if err != nil {
		t.Fatalf("init lumberjack output plugin failed: %v", err)
	}

	return output
}