File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1363,8 +1363,15 @@ bool CcdbApi::isHostReachable() const
13631363 curl = curl_easy_init ();
13641364 curl_easy_setopt (curl, CURLOPT_USERAGENT , mUniqueAgentID .c_str ());
13651365 if (curl) {
1366+ // Each host in turn, not mUrl: mUrl holds whatever was passed to init(),
1367+ // which for a failover setup is the whole comma-separated list. curl
1368+ // rejects that as malformed (CURLE_URL_MALFORMAT), so every multi-host
1369+ // instance reported itself unreachable no matter how healthy its hosts
1370+ // were -- and testCcdbApiMultipleUrls, whose cases are gated on this,
1371+ // silently skipped instead of running.
13661372 for (size_t hostIndex = 0 ; hostIndex < hostsPool.size () && res != CURLE_OK ; hostIndex++) {
1367- curl_easy_setopt (curl, CURLOPT_URL , mUrl .data ());
1373+ std::string url = getHostUrl (hostIndex);
1374+ curl_easy_setopt (curl, CURLOPT_URL , url.c_str ());
13681375 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION , write_data);
13691376 curlSetSSLOptions (curl);
13701377 res = CURL_perform (curl);
Original file line number Diff line number Diff line change 1717#include " CCDB/CCDBTimeStampUtils.h"
1818#include < boost/test/unit_test.hpp>
1919#include < cstdio>
20+ #include < cstdlib>
2021#include < TH1F.h>
2122
2223using namespace std ;
@@ -35,7 +36,13 @@ struct Fixture {
3536 Fixture ()
3637 {
3738 CcdbApi api;
38- ccdbUrl = " https://localhost:22,https://localhost:8080,http://ccdb-test.cern.ch:8080" ;
39+ // This suite uploads, so it needs a WRITABLE instance -- ccdb-test by
40+ // default, not the official CCDB. Only the LAST entry is configurable:
41+ // what is under test here is the failover, so the two dead endpoints in
42+ // front of it are part of the fixture and stay hardcoded.
43+ const char * host = std::getenv (" ALICEO2_CCDB_HOST" );
44+ ccdbUrl = " https://localhost:22,https://localhost:8080," ;
45+ ccdbUrl += host ? host : " http://ccdb-test.cern.ch:8080" ;
3946 api.init (ccdbUrl);
4047 cout << " ccdb url: " << ccdbUrl << endl;
4148 hostReachable = api.isHostReachable ();
You can’t perform that action at this time.
0 commit comments