package cloudwatch

import (
	"fmt"
	"math/rand"
	"testing"
	"time"

	"github.com/Pallinder/go-randomdata"
	"github.com/gliderlabs/logspout/router"
)

const NumMessages = 25000000

func TestCloudWatchAdapter(t *testing.T) {
	if testing.Short() {
		t.Skip("Skipping integration test in short mode.")
	}

	route := &router.Route{Address: "logspout-cloudwatch"}
	messages := make(chan *router.Message)

	adapter, err := NewAdapter(route)
	if err != nil {
		t.Error(err)
		return
	}

	go adapter.Stream(messages)
	for i := 0; i < NumMessages; i++ {
		messages <- createMessage()
	}

	close(messages)
}

func createMessage() *router.Message {
	data := ""
	timestamp := time.Now()
	random := rand.Intn(100)

	if random == 0 {
		data = randomdata.Paragraph()
	}

	return &router.Message{Data: data, Time: timestamp}
}

package cloudwatch

import (
	"testing"
	"time"

	"github.com/Pallinder/go-randomdata"
	"github.com/gliderlabs/logspout/router"
)

const NumMessages = 25000000

func TestCloudWatchAdapter(t *testing.T) {
	if testing.Short() {
		t.Skip("Skipping integration test in short mode.")
	}

	route := &router.Route{Address: "logspout-cloudwatch"}
	messages := make(chan *router.Message)

	adapter, err := NewAdapter(route)
	if err != nil {
		t.Error(err)
		return
	}

	go adapter.Stream(messages)
	for i := 0; i < NumMessages; i++ {
		messages <- &router.Message{Data: randomdata.Paragraph(), Time: time.Now()}
	}

	close(messages)
}

--- 
+++ 
@@ -1,6 +1,8 @@
 package cloudwatch
 
 import (
+	"fmt"
+	"math/rand"
 	"testing"
 	"time"
 
@@ -26,8 +28,20 @@
 
 	go adapter.Stream(messages)
 	for i := 0; i < NumMessages; i++ {
-		messages <- &router.Message{Data: randomdata.Paragraph(), Time: time.Now()}
+		messages <- createMessage()
 	}
 
 	close(messages)
 }
+
+func createMessage() *router.Message {
+	data := ""
+	timestamp := time.Now()
+	random := rand.Intn(100)
+
+	if random == 0 {
+		data = randomdata.Paragraph()
+	}
+
+	return &router.Message{Data: data, Time: timestamp}
+}
Add empty messages to integration test.
