Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update metricbeat to use new publisher API #4699

Merged
merged 7 commits into from
Jul 19, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update libbeat/publisher/testing unit test
urso committed Jul 19, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c8bda898aa876363c80e21c66cf3cc0e1f8bc45b
16 changes: 10 additions & 6 deletions libbeat/publisher/testing/testing_test.go
Original file line number Diff line number Diff line change
@@ -4,15 +4,19 @@ import (
"testing"

"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/publisher/beat"
"github.com/stretchr/testify/assert"
)

var cnt = 0

func testEvent() common.MapStr {
event := common.MapStr{}
event["message"] = "test"
event["idx"] = cnt
func testEvent() beat.Event {
event := beat.Event{
Fields: common.MapStr{
"message": "test",
"idx": cnt,
},
}
cnt++
return event
}
@@ -21,7 +25,7 @@ func testEvent() common.MapStr {
func TestChanClientPublishEvent(t *testing.T) {
cc := NewChanClient(1)
e1 := testEvent()
cc.PublishEvent(e1)
cc.Publish(e1)
assert.Equal(t, e1, cc.ReceiveEvent())
}

@@ -30,7 +34,7 @@ func TestChanClientPublishEvents(t *testing.T) {
cc := NewChanClient(1)

e1, e2 := testEvent(), testEvent()
cc.PublishEvents([]common.MapStr{e1, e2})
go cc.PublishAll([]beat.Event{e1, e2})
assert.Equal(t, e1, cc.ReceiveEvent())
assert.Equal(t, e2, cc.ReceiveEvent())
}