Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Framework/test/testCcdbDatabase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ using namespace o2::quality_control::core;
using namespace o2::quality_control::repository;
using namespace std;

// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

// These tests upload, so this has to be a WRITABLE instance -- ccdb-test by
// default. ALICEO2_CCDB_HOST lets a network-isolated build container reach one
// through a broker instead; unset, behaviour is unchanged.
Expand Down Expand Up @@ -360,7 +370,7 @@ BOOST_AUTO_TEST_CASE(ccdb_test_thread_api, *utf::depends_on("ccdb_store"))
BOOST_AUTO_TEST_CASE(ccdb_test_no_thread_api)
{
unique_ptr<o2::ccdb::CcdbApi> api = std::make_unique<o2::ccdb::CcdbApi>();
string ccdbUrl = "http://ali-qcdb-test.cern.ch:8083";
string ccdbUrl = "http://" + QCDB_ENDPOINT;
api->init(ccdbUrl);
cout << "ccdb url: " << ccdbUrl << endl;
bool hostReachable = api->isHostReachable();
Expand Down
13 changes: 12 additions & 1 deletion Framework/test/testDbFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,21 @@
#include <QualityControl/RepoPathUtils.h>
#include <QualityControl/testUtils.h>
#include <TH1F.h>
#include <cstdlib>

using namespace std;
using namespace o2::quality_control::core;

// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

namespace o2::quality_control::repository
{

Expand Down Expand Up @@ -68,7 +79,7 @@ BOOST_AUTO_TEST_CASE(db_ccdb_listing)
auto* ccdb = dynamic_cast<CcdbDatabase*>(database3.get());
BOOST_CHECK(ccdb);

ccdb->connect("ali-qcdb-test.cern.ch:8083", "", "", "");
ccdb->connect(QCDB_ENDPOINT, "", "", "");

// prepare stuff in the db
string prefixPath = "qc/TST/MO/";
Expand Down
15 changes: 13 additions & 2 deletions Framework/test/testTaskInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ o2::framework::ConfigParamRegistry createDummyRegistry()
#include <Framework/ConfigParamRegistry.h>
#include <Framework/ServiceRegistry.h>
#include <catch_amalgamated.hpp>
#include <cstdlib>

using namespace o2::quality_control;
using namespace std;
Expand All @@ -62,6 +63,16 @@ namespace o2::quality_control

using namespace core;

// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

namespace test
{
class TestTask : public TaskInterface
Expand Down Expand Up @@ -201,14 +212,14 @@ TEST_CASE("retrieveCondition")
bad.addBadChannel(3, o2::emcal::BadChannelMap::MaskType_t::DEAD_CELL);
std::map<std::string, std::string> meta;
o2::ccdb::CcdbApi api;
api.init("ali-qcdb-test.cern.ch:8083");
api.init(QCDB_ENDPOINT);
api.storeAsTFileAny<o2::emcal::BadChannelMap>(&bad, "qc/TST/conditions", meta);

// retrieve it
TaskRunnerConfig taskConfig;
auto* objectsManager = new ObjectsManager(taskConfig.name, taskConfig.className, taskConfig.detectorName, 0);
test::TestTask testTask(objectsManager);
testTask.setCcdbUrl("ali-qcdb-test.cern.ch:8083");
testTask.setCcdbUrl(QCDB_ENDPOINT);
o2::emcal::BadChannelMap* bcm = testTask.testRetrieveCondition();
CHECK(bcm->getChannelStatus(1) == o2::emcal::BadChannelMap::MaskType_t::GOOD_CELL);
CHECK(bcm->getChannelStatus(3) == o2::emcal::BadChannelMap::MaskType_t::DEAD_CELL);
Expand Down
13 changes: 12 additions & 1 deletion Framework/test/testTimekeeper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@
#include <CommonUtils/ConfigurableParam.h>

#include <catch_amalgamated.hpp>
#include <cstdlib>

using namespace o2::quality_control::core;
using namespace o2::framework;

// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

TEST_CASE("timekeeper_synchronous")
{
SECTION("defaults")
Expand Down Expand Up @@ -310,7 +321,7 @@ TEST_CASE("timekeeper_asynchronous")
{
auto tk = std::make_shared<TimekeeperAsynchronous>();

o2::conf::ConfigurableParam::updateFromString("NameConf.mCCDBServer=http://ali-qcdb-test.cern.ch:8083");
o2::conf::ConfigurableParam::updateFromString("NameConf.mCCDBServer=http://" + QCDB_ENDPOINT);

// CCDB RCT first
// TODO reactivate but we need the info in ali-qcdb-test (it is only in ccdb-test)
Expand Down
22 changes: 16 additions & 6 deletions Framework/test/testTrendingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,22 @@
#include <functional>

#include <catch_amalgamated.hpp>
#include <cstdlib>

using namespace o2::quality_control::core;
using namespace o2::quality_control::postprocessing;
using namespace o2::quality_control::repository;
using namespace o2::framework;

const std::string CCDB_ENDPOINT = "ali-qcdb-test.cern.ch:8083";
// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

struct CleanupAtDestruction {
public:
Expand Down Expand Up @@ -86,7 +95,8 @@ TEST_CASE("test_trending_task")
"config": {
"database": {
"implementation": "CCDB",
"host": "ali-qcdb-test.cern.ch:8083"
"host": ")json"
<< QCDB_ENDPOINT << R"json("
},
"Activity": {},
"monitoring": {
Expand All @@ -105,7 +115,7 @@ TEST_CASE("test_trending_task")
{
"type": "repository",
"path": "TST/MO/)json" +
taskName + R"json(",
taskName + R"json(",
"name": "testHistoTrending",
"reductorName": "o2::quality_control_modules::common::TH1Reductor",
"reductorParameters": {
Expand All @@ -121,7 +131,7 @@ TEST_CASE("test_trending_task")
"type": "repository-quality",
"path": "TST/QO",
"names": [ ")json" +
checkName + R"json(" ],
checkName + R"json(" ],
"reductorName": "o2::quality_control_modules::common::QualityReductor",
"moduleName": "QcCommon"
}
Expand All @@ -140,7 +150,7 @@ TEST_CASE("test_trending_task")
"name": "quality_histogram",
"title": "Histogram of qualities",
"varexp": ")json" +
checkName + R"json(.level",
checkName + R"json(.level",
"selection": "",
"option": ""
}
Expand All @@ -157,7 +167,7 @@ TEST_CASE("test_trending_task")

// clean
std::shared_ptr<DatabaseInterface> repository = DatabaseFactory::create("CCDB");
repository->connect(CCDB_ENDPOINT, "", "", "");
repository->connect(QCDB_ENDPOINT, "", "", "");
repository->truncate("qc/TST/MO/" + taskName, "*");
repository->truncate("qc/TST/QO", checkName);

Expand Down
16 changes: 13 additions & 3 deletions Framework/test/testTriggerHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@
#include "QualityControl/TriggerHelpers.h"
#include "QualityControl/PostProcessingConfig.h"
#include <catch_amalgamated.hpp>
#include <cstdlib>

using namespace o2::quality_control::postprocessing;
const std::string CCDB_ENDPOINT = "ali-qcdb-test.cern.ch:8083";

// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

TEST_CASE("test_factory")
{
Expand Down Expand Up @@ -63,8 +73,8 @@ TEST_CASE("test_factory")

// generating new object trigger
PostProcessingConfig configWithDBs;
configWithDBs.repository["host"] = CCDB_ENDPOINT;
configWithDBs.ccdbUrl = CCDB_ENDPOINT;
configWithDBs.repository["host"] = QCDB_ENDPOINT;
configWithDBs.ccdbUrl = QCDB_ENDPOINT;
CHECK_NOTHROW(trigger_helpers::triggerFactory("newobject:qcdb:qc/asdf/vcxz", configWithDBs));
CHECK_NOTHROW(trigger_helpers::triggerFactory("newobject:ccdb:qc/asdf/vcxz", configWithDBs));
CHECK_NOTHROW(trigger_helpers::triggerFactory("newobject:QCDB:qc/asdf/vcxz", configWithDBs));
Expand Down
17 changes: 14 additions & 3 deletions Framework/test/testUserCodeInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@

#include <QualityControl/CcdbDatabase.h>
#include <QualityControl/CustomParameters.h>
#include <cstdlib>

using namespace std;
using namespace o2::quality_control::repository;
using namespace o2::quality_control::core;

// A QC-specific CCDB instance: ali-qcdb-test by default. It holds different
// objects from ccdb-test -- see the TODO in testTimekeeper.cxx -- so this is
// deliberately NOT ALICEO2_CCDB_HOST. ALICEO2_QCDB_HOST lets a network-isolated
// build container reach it through a broker instead; unset, behaviour is
// unchanged.
const std::string QCDB_ENDPOINT = [] {
const char* host = std::getenv("ALICEO2_QCDB_HOST");
return std::string((host && *host) ? host : "ali-qcdb-test.cern.ch:8083");
}();

namespace o2::quality_control
{

Expand Down Expand Up @@ -65,7 +76,7 @@ struct MyGlobalFixture {
void teardown()
{
auto backend = std::make_unique<CcdbDatabase>();
backend->connect("ali-qcdb-test.cern.ch:8083", "", "", "");
backend->connect(QCDB_ENDPOINT, "", "", "");
backend->truncate("qc/TST/MO/Test/pid" + std::to_string(getpid()), "*");
}
};
Expand All @@ -82,7 +93,7 @@ BOOST_AUTO_TEST_CASE(test_invoke_all_methods)
auto taskName = "Test/pid" + pid;
shared_ptr<MonitorObject> mo1 = make_shared<MonitorObject>(h1, taskName, "task", "TST");
auto backend = std::make_unique<CcdbDatabase>();
backend->connect("ali-qcdb-test.cern.ch:8083", "", "", "");
backend->connect(QCDB_ENDPOINT, "", "", "");
backend->storeMO(mo1);

// setting custom parameters should configure
Expand All @@ -92,7 +103,7 @@ BOOST_AUTO_TEST_CASE(test_invoke_all_methods)
BOOST_CHECK_EQUAL(testInterface.configured, true);
BOOST_CHECK_EQUAL(testInterface.get("test"), "asdf");

testInterface.setCcdbUrl("ali-qcdb-test.cern.ch:8083");
testInterface.setCcdbUrl(QCDB_ENDPOINT);
auto obj = testInterface.retrieveConditionAny<TObject>("qc/TST/MO/" + taskName + "/asdf");
BOOST_CHECK_NE(obj, nullptr);
}
Expand Down
Loading