aports/testing/mtg/skip-tests-on-network-error.patch
Kevin Daudt 167fd3900b testing/mtg: skip network tests on network error
This is not an indication of an error, and for some reason, httpbin.org
is not reachable from the ppc64le builders.
2021-05-30 09:28:29 +00:00

32 lines
1.0 KiB
Diff

Description: These tests try to connect to httpbin.org to do some testing. When
httpbin.org is not available, this does not indicate a test failure. Furthermore,
just calling suite.NoError does not stop the execution of the function, so it
would error out when respo.Body is nil.
diff --git a/network/network_test.go b/network/network_test.go
index 86b5f0c..e46a538 100644
--- a/network/network_test.go
+++ b/network/network_test.go
@@ -32,7 +32,9 @@ func (suite *NetworkTestSuite) TestLocalHTTPRequest() {
client := ntw.MakeHTTPClient(nil)
resp, err := client.Get(suite.httpServer.URL + "/headers") // nolint: noctx
- suite.NoError(err)
+ if ! suite.NoError(err) {
+ suite.T().Skip("Network error")
+ }
defer resp.Body.Close()
@@ -57,7 +59,9 @@ func (suite *NetworkTestSuite) TestRealHTTPRequest() {
client := ntw.MakeHTTPClient(nil)
resp, err := client.Get("https://httpbin.org/headers") // nolint: noctx
- suite.NoError(err)
+ if ! suite.NoError(err) {
+ suite.T().Skip("Network error")
+ }
defer resp.Body.Close()