Skip to content

Commit

Permalink
Update test and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
liketic committed Nov 7, 2017
1 parent df0b8b6 commit 734ad81
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di
- Fix data race accessing watched containers. {issue}5147[5147]
- Remove ID() from Runner interface {issue}5153[5153]
- Do not require template if index change and template disabled {pull}5319[5319]
- Avoid double slash when join url and path {pull}5517[5517]

*Auditbeat*

Expand Down
46 changes: 46 additions & 0 deletions libbeat/outputs/elasticsearch/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,49 @@ func TestClientWithHeaders(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 2, requestCount)
}

func TestAddToURL(t *testing.T) {
type Test struct {
url string
path string
pipeline string
params map[string]string
expected string
}
tests := []Test{
{
url: "localhost:9200",
path: "/path",
pipeline: "",
params: make(map[string]string),
expected: "localhost:9200/path",
},
{
url: "localhost:9200/",
path: "/path",
pipeline: "",
params: make(map[string]string),
expected: "localhost:9200/path",
},
{
url: "localhost:9200",
path: "/path",
pipeline: "pipeline_1",
params: make(map[string]string),
expected: "localhost:9200/path?pipeline=pipeline_1",
},
{
url: "localhost:9200/",
path: "/path",
pipeline: "",
params: map[string]string{
"param": "value",
},
expected: "localhost:9200/path?param=value",
},
}
for _, test := range tests {
url := addToURL(test.url, test.path, test.pipeline, test.params)
assert.Equal(t, url, test.expected)
}
}

0 comments on commit 734ad81

Please sign in to comment.