Linux test_HTTP fixes.
libCurl HTTP unit-test fixes.
This commit is contained in:
parent
b5d6aa3fe4
commit
598b64fa95
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
|
|
||||||
|
#include <simgear/simgear_config.h>
|
||||||
|
|
||||||
#include "HTTPClient.hxx"
|
#include "HTTPClient.hxx"
|
||||||
#include "HTTPRequest.hxx"
|
#include "HTTPRequest.hxx"
|
||||||
|
|
||||||
@ -15,6 +17,10 @@
|
|||||||
#include <simgear/timing/timestamp.hxx>
|
#include <simgear/timing/timestamp.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
|
#if defined(ENABLE_CURL)
|
||||||
|
#include <curl/multi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -663,16 +669,21 @@ int main(int argc, char* argv[])
|
|||||||
cout << "done3" << endl;
|
cout << "done3" << endl;
|
||||||
// test connectToHost failure
|
// test connectToHost failure
|
||||||
|
|
||||||
// causes timeout on Jenkins slaves
|
|
||||||
#if 1
|
|
||||||
{
|
{
|
||||||
TestRequest* tr = new TestRequest("http://not.found/something");
|
TestRequest* tr = new TestRequest("http://not.found/something");
|
||||||
HTTP::Request_ptr own(tr);
|
HTTP::Request_ptr own(tr);
|
||||||
cl.makeRequest(tr);
|
cl.makeRequest(tr);
|
||||||
waitForFailed(&cl, tr);
|
waitForFailed(&cl, tr);
|
||||||
COMPARE(tr->responseCode(), ENOENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#if defined(ENABLE_CURL)
|
||||||
|
const int HOST_NOT_FOUND_CODE = CURLE_COULDNT_RESOLVE_HOST;
|
||||||
|
#else
|
||||||
|
const int HOST_NOT_FOUND_CODE = ENOENT;
|
||||||
#endif
|
#endif
|
||||||
|
COMPARE(tr->responseCode(), HOST_NOT_FOUND_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
cout << "testing abrupt close" << endl;
|
cout << "testing abrupt close" << endl;
|
||||||
// test server-side abrupt close
|
// test server-side abrupt close
|
||||||
@ -681,7 +692,13 @@ int main(int argc, char* argv[])
|
|||||||
HTTP::Request_ptr own(tr);
|
HTTP::Request_ptr own(tr);
|
||||||
cl.makeRequest(tr);
|
cl.makeRequest(tr);
|
||||||
waitForFailed(&cl, tr);
|
waitForFailed(&cl, tr);
|
||||||
COMPARE(tr->responseCode(), 500);
|
|
||||||
|
#if defined(ENABLE_CURL)
|
||||||
|
const int SERVER_NO_DATA_CODE = CURLE_GOT_NOTHING;
|
||||||
|
#else
|
||||||
|
const int SERVER_NO_DATA_CODESERVER_NO_DATA_CODE = 500;
|
||||||
|
#endif
|
||||||
|
COMPARE(tr->responseCode(), SERVER_NO_DATA_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "testing proxy close" << endl;
|
cout << "testing proxy close" << endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user