Skip to content

Commit

Permalink
test: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
kruskall committed Mar 6, 2025
1 parent bae5fc3 commit 5cc749c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions x-pack/filebeat/input/http_endpoint/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"

v2 "github.com/elastic/beats/v7/filebeat/input/v2"
"github.com/elastic/elastic-agent-libs/logp"
Expand Down Expand Up @@ -432,6 +433,18 @@ func TestServerPool(t *testing.T) {
}
}

func TestNewHTTPEndpoint(t *testing.T) {
cfg := config{
ListenAddress: "0:0:0:0:0:0:0:1",
ListenPort: "9200",
ResponseBody: "{}",
Method: http.MethodPost,
}
h, err := newHTTPEndpoint(cfg)
require.NoError(t, err)
require.Equal(t, "[0:0:0:0:0:0:0:1]:9200", h.addr)
}

func doRequest(method, url, contentType string, body io.Reader) (*http.Response, error) {
if method == "" {
method = http.MethodPost
Expand Down

0 comments on commit 5cc749c

Please sign in to comment.