forked from mirror/client_golang
Fix unit test failing with Go1.14+
Signed-off-by: RainbowMango <renhongcai@huawei.com>
This commit is contained in:
parent
efb148ca4d
commit
af6ade7230
|
@ -15,10 +15,10 @@ package promhttp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -186,8 +186,9 @@ func TestClientMiddlewareAPIWithRequestContextTimeout(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("did not get timeout error")
|
t.Fatal("did not get timeout error")
|
||||||
}
|
}
|
||||||
if want, got := fmt.Sprintf("Get %s: context deadline exceeded", backend.URL), err.Error(); want != got {
|
expectedMsg := "context deadline exceeded"
|
||||||
t.Fatalf("want error %q, got %q", want, got)
|
if !strings.Contains(err.Error(), expectedMsg) {
|
||||||
|
t.Fatalf("unexpected error: %q, expect error: %q", err.Error(), expectedMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue