Internet connection is not available on build servers, making tests fail #1365

This commit is contained in:
Alex Fabijanic 2017-10-06 18:22:54 -05:00
parent 888e193511
commit 14076f75b4

View File

@ -14,6 +14,7 @@
#include "Poco/Net/NTPClient.h"
#include "Poco/Net/NTPEventArgs.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/ICMPClient.h"
#include "Poco/Net/NetException.h"
#include "Poco/AutoPtr.h"
#include "Poco/Delegate.h"
@ -27,6 +28,7 @@ using Poco::Net::NTPClient;
using Poco::Net::NTPEventArgs;
using Poco::Net::SocketAddress;
using Poco::Net::IPAddress;
using Poco::Net::ICMPClient;
using Poco::Net::HostNotFoundException;
using Poco::Delegate;
using Poco::AutoPtr;
@ -46,6 +48,11 @@ NTPClientTest::~NTPClientTest()
void NTPClientTest::testTimeSync()
{
if (ICMPClient::pingIPv4("pool.ntp.org") <= 0)
{
std::cerr << "pool.ntp.org not accessibe, test skipped" << std::endl;
return;
}
assert(_ntpClient.request("pool.ntp.org") > 0);
}