Retry in URL test when running in a CI environment

There are episodic failures in this test when running under AppVeyor,
check if retrying to connect can work around them.
This commit is contained in:
Vadim Zeitlin
2019-01-12 15:39:09 +01:00
parent 50c90f9174
commit 3c468260ff

View File

@@ -23,6 +23,7 @@
#include "wx/url.h"
#include "wx/mstream.h"
#include "wx/scopedptr.h"
#include "wx/utils.h"
// ----------------------------------------------------------------------------
// test class
@@ -75,6 +76,15 @@ void URLTestCase::GetInputStream()
CPPUNIT_ASSERT_EQUAL(wxURL_NOERR, url.GetError());
wxScopedPtr<wxInputStream> in_stream(url.GetInputStream());
if ( !in_stream && IsAutomaticTest() )
{
// Sometimes the connection fails during CI runs, try to connect once
// again if this happens in the hope it was just a transient error.
wxSleep(3);
WARN("Connection to www.wxwidgets.org failed, retrying...");
in_stream.reset(url.GetInputStream());
}
CPPUNIT_ASSERT(in_stream);
CPPUNIT_ASSERT(in_stream->IsOk());