Skip to content

Commit 816ca2b

Browse files
authored
[QC-1351] Test was partially commented out by mistake (#2705)
1 parent 5d6400b commit 816ca2b

1 file changed

Lines changed: 56 additions & 56 deletions

File tree

‎Framework/test/testTrendingTask.cxx‎

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -245,60 +245,60 @@ TEST_CASE("test_trending_task")
245245
}
246246
});
247247

248-
// // Running the task
249-
// ServiceRegistry services;
250-
// services.registerService<DatabaseInterface>(repository.get());
251-
// auto objectManager = std::make_shared<ObjectsManager>(taskName, "o2::quality_control::postprocessing::TrendingTask", "TST");
252-
//
253-
// TrendingTask task;
254-
// task.setName(trendingTaskName);
255-
// task.setID(trendingTaskID);
256-
// task.setObjectsManager(objectManager);
257-
// REQUIRE_NOTHROW(task.configure(config));
258-
//
259-
// // test initialize()
260-
// REQUIRE_NOTHROW(task.initialize({ TriggerType::UserOrControl, true, { 0, "NONE", "", "", "qc" }, 1 }, services));
261-
// REQUIRE(objectManager->getNumberPublishedObjects() == 1);
262-
// auto treeMO = objectManager->getMonitorObject(trendingTaskName);
263-
// REQUIRE(treeMO != nullptr);
264-
// TTree* tree = dynamic_cast<TTree*>(treeMO->getObject());
265-
// REQUIRE(tree != nullptr);
266-
// REQUIRE(tree->GetEntries() == 0);
267-
//
268-
// // test update()
269-
// task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 2, 100000 } }, 100000 - 1 }, services);
270-
// objectManager->stopPublishing(PublicationPolicy::Once);
271-
// task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 100000, 200000 } }, 200000 - 1 }, services);
272-
// REQUIRE(objectManager->getNumberPublishedObjects() == 3);
273-
// REQUIRE(tree->GetEntries() == 2);
274-
// auto varexp = "testHistoTrending.mean:testHistoTrending.entries:" + checkName + ".level";
275-
// tree->Draw(varexp.c_str(), "", "goff");
276-
// Double_t* means = tree->GetVal(0);
277-
// Double_t* entries = tree->GetVal(1);
278-
// Double_t* qualityLevels = tree->GetVal(2);
279-
// CHECK_THAT(means[0], Catch::Matchers::WithinAbs(5, 0.01));
280-
// CHECK_THAT(entries[0], Catch::Matchers::WithinAbs(3, 0.01));
281-
// CHECK_THAT(qualityLevels[0], Catch::Matchers::WithinAbs(3, 0.01));
282-
// CHECK_THAT(means[1], Catch::Matchers::WithinAbs(5, 0.01));
283-
// CHECK_THAT(entries[1], Catch::Matchers::WithinAbs(4, 0.01));
284-
// CHECK_THAT(qualityLevels[1], Catch::Matchers::WithinAbs(1, 0.01));
285-
//
286-
// auto histo1MO = objectManager->getMonitorObject("mean_of_histogram");
287-
// REQUIRE(histo1MO != nullptr);
288-
// auto histo1 = dynamic_cast<TCanvas*>(histo1MO->getObject());
289-
// REQUIRE(histo1 != nullptr);
290-
// CHECK(std::strcmp(histo1->GetName(), "mean_of_histogram") == 0);
291-
// auto histo2MO = objectManager->getMonitorObject("quality_histogram");
292-
// REQUIRE(histo2MO != nullptr);
293-
// auto histo2 = dynamic_cast<TCanvas*>(histo2MO->getObject());
294-
// REQUIRE(histo2 != nullptr);
295-
// CHECK(std::strcmp(histo2->GetName(), "quality_histogram") == 0);
296-
// objectManager->stopPublishing(PublicationPolicy::Once);
297-
//
298-
// // test finalize()
299-
// REQUIRE_NOTHROW(task.finalize({ TriggerType::UserOrControl, true }, services));
300-
// REQUIRE(objectManager->getNumberPublishedObjects() == 3);
301-
// REQUIRE(tree->GetEntries() == 2);
302-
// objectManager->stopPublishing(PublicationPolicy::Once);
303-
// objectManager->stopPublishing(PublicationPolicy::ThroughStop);
248+
// Running the task
249+
ServiceRegistry services;
250+
services.registerService<DatabaseInterface>(repository.get());
251+
auto objectManager = std::make_shared<ObjectsManager>(taskName, "o2::quality_control::postprocessing::TrendingTask", "TST");
252+
253+
TrendingTask task;
254+
task.setName(trendingTaskName);
255+
task.setID(trendingTaskID);
256+
task.setObjectsManager(objectManager);
257+
REQUIRE_NOTHROW(task.configure(config));
258+
259+
// test initialize()
260+
REQUIRE_NOTHROW(task.initialize({ TriggerType::UserOrControl, true, { 0, "NONE", "", "", "qc" }, 1 }, services));
261+
REQUIRE(objectManager->getNumberPublishedObjects() == 1);
262+
auto treeMO = objectManager->getMonitorObject(trendingTaskName);
263+
REQUIRE(treeMO != nullptr);
264+
TTree* tree = dynamic_cast<TTree*>(treeMO->getObject());
265+
REQUIRE(tree != nullptr);
266+
REQUIRE(tree->GetEntries() == 0);
267+
268+
// test update()
269+
task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 2, 100000 } }, 100000 - 1 }, services);
270+
objectManager->stopPublishing(PublicationPolicy::Once);
271+
task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 100000, 200000 } }, 200000 - 1 }, services);
272+
REQUIRE(objectManager->getNumberPublishedObjects() == 3);
273+
REQUIRE(tree->GetEntries() == 2);
274+
auto varexp = "testHistoTrending.mean:testHistoTrending.entries:" + checkName + ".level";
275+
tree->Draw(varexp.c_str(), "", "goff");
276+
Double_t* means = tree->GetVal(0);
277+
Double_t* entries = tree->GetVal(1);
278+
Double_t* qualityLevels = tree->GetVal(2);
279+
CHECK_THAT(means[0], Catch::Matchers::WithinAbs(5, 0.01));
280+
CHECK_THAT(entries[0], Catch::Matchers::WithinAbs(3, 0.01));
281+
CHECK_THAT(qualityLevels[0], Catch::Matchers::WithinAbs(3, 0.01));
282+
CHECK_THAT(means[1], Catch::Matchers::WithinAbs(5, 0.01));
283+
CHECK_THAT(entries[1], Catch::Matchers::WithinAbs(4, 0.01));
284+
CHECK_THAT(qualityLevels[1], Catch::Matchers::WithinAbs(1, 0.01));
285+
286+
auto histo1MO = objectManager->getMonitorObject("mean_of_histogram");
287+
REQUIRE(histo1MO != nullptr);
288+
auto histo1 = dynamic_cast<TCanvas*>(histo1MO->getObject());
289+
REQUIRE(histo1 != nullptr);
290+
CHECK(std::strcmp(histo1->GetName(), "mean_of_histogram") == 0);
291+
auto histo2MO = objectManager->getMonitorObject("quality_histogram");
292+
REQUIRE(histo2MO != nullptr);
293+
auto histo2 = dynamic_cast<TCanvas*>(histo2MO->getObject());
294+
REQUIRE(histo2 != nullptr);
295+
CHECK(std::strcmp(histo2->GetName(), "quality_histogram") == 0);
296+
objectManager->stopPublishing(PublicationPolicy::Once);
297+
298+
// test finalize()
299+
REQUIRE_NOTHROW(task.finalize({ TriggerType::UserOrControl, true }, services));
300+
REQUIRE(objectManager->getNumberPublishedObjects() == 3);
301+
REQUIRE(tree->GetEntries() == 2);
302+
objectManager->stopPublishing(PublicationPolicy::Once);
303+
objectManager->stopPublishing(PublicationPolicy::ThroughStop);
304304
}

0 commit comments

Comments
 (0)