Skip to content

Commit

Permalink
update error output and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
legoguy1000 committed Apr 6, 2021
1 parent 5569cf0 commit 85d5b0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/awss3/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func getRegionFromQueueURL(queueURL string, endpoint string) (string, error) {
// Example: https://sqs.us-east-1.amazonaws.com/627959692251/test-s3-logs
url, err := url.Parse(queueURL)
if err != nil {
return "", fmt.Errorf("QueueURL is not a valid URL")
return "", fmt.Errorf(queueURL + " is not a valid URL")
}
if url.Scheme == "https" && url.Host != "" {
queueHostSplit := strings.Split(url.Host, ".")
Expand Down
6 changes: 6 additions & 0 deletions x-pack/filebeat/input/awss3/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ func TestGetRegionFromQueueURL(t *testing.T) {
"googlecloud.com",
"",
},
{
"QueueURL is an invalid URL",
":foo",
"",
"",
},
}

for _, c := range casesNegative {
Expand Down

0 comments on commit 85d5b0f

Please sign in to comment.