Skip to content

Commit

Permalink
fixed tests (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianciutea authored and Kav91 committed Jan 24, 2020
1 parent a51234f commit e2bfe52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
golang:
image: golang:1.11.4-stretch
image: golang:1.13.6-stretch
volumes:
- .:/go/src/github.com/newrelic/nri-flex
working_dir: /go/src/github.com/newrelic/nri-flex
Expand Down
7 changes: 5 additions & 2 deletions internal/inputs/netdial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"regexp"
"runtime"
"strings"
"testing"
Expand Down Expand Up @@ -62,10 +63,12 @@ func TestNetDial(t *testing.T) {
for key := range sample {
if recSample[key] != nil {
if key == "err" {
allowedErrors := []string{"dial tcp: lookup fake12311290.com: no such host", "context deadline exceeded", "dial tcp: i/o timeout"}
allowedErrors := []string{"dial tcp: lookup fake12311290.com(.*?): no such host", "context deadline exceeded", "dial tcp: i/o timeout"}
foundError := false

for _, allowedError := range allowedErrors {
if allowedError == fmt.Sprintf("%v", recSample[key]) {
p := regexp.MustCompile(allowedError)
if p.MatchString(fmt.Sprintf("%v", recSample[key])) {
foundError = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker-compose-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
golang:
image: golang:1.11.4-stretch
image: golang:1.13.6-stretch
volumes:
- ../:/go/src/github.com/newrelic/nri-flex
working_dir: /go/src/github.com/newrelic/nri-flex

0 comments on commit e2bfe52

Please sign in to comment.