Fix test to also match on travis

This commit is contained in:
xenolf 2015-10-30 13:26:22 +01:00
parent 34fe2a5547
commit f91d853068

View file

@ -7,6 +7,7 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"regexp"
"testing" "testing"
"github.com/square/go-jose" "github.com/square/go-jose"
@ -57,9 +58,10 @@ func TestSimpleHTTPConnectionRefusal(t *testing.T) {
if err := solver.Solve(clientChallenge, "test.domain"); err == nil { if err := solver.Solve(clientChallenge, "test.domain"); err == nil {
t.Error("UNEXPECTED: Expected Solve to return an error but the error was nil.") t.Error("UNEXPECTED: Expected Solve to return an error but the error was nil.")
} else { } else {
expectedError := "Failed to post JWS message. -> Post http://localhost:4000: dial tcp 127.0.0.1:4000: getsockopt: connection refused" reg := "Failed to post JWS message\\. -> Post http:\\/\\/localhost:4000: dial tcp 127\\.0\\.0\\.1:4000: (getsockopt: )?connection refused"
if err.Error() != expectedError { r, _ := regexp.Compile(reg)
t.Errorf("Expected error %s but instead got %s", expectedError, err.Error()) if r.MatchString(err.Error()) {
t.Errorf("Expected error to match %s but instead got %s", reg, err.Error())
} }
} }
} }