Skip to content

Commit b0610c8

Browse files
authored
Exclude some tests (#204)
* Move some tests that should not be run automatically
1 parent 4ceef5e commit b0610c8

5 files changed

Lines changed: 105 additions & 32 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ find_package(Boost 1.58
8686
program_options
8787
system
8888
log
89-
signals
9089
system)
9190
find_package(Git QUIET)
9291
find_package(Configuration REQUIRED)

Framework/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ set(TEST_SRCS
169169
test/testQuality.cxx
170170
test/testObjectsManager.cxx
171171
test/testCcdbDatabase.cxx
172+
test/testCcdbDatabaseExtra.cxx
172173
test/testWorkflow.cxx)
173174

174175
set(TEST_ARGS
@@ -184,6 +185,7 @@ set(TEST_ARGS
184185
""
185186
""
186187
""
188+
""
187189
"-b --run")
188190

189191
list(LENGTH TEST_SRCS count)
@@ -217,6 +219,7 @@ set_property(TEST testWorkflow PROPERTY TIMEOUT 120)
217219
set_property(TEST testWorkflow PROPERTY LABELS slow)
218220
set_property(TEST testObjectsManager PROPERTY TIMEOUT 120)
219221
set_property(TEST testObjectsManager PROPERTY LABELS slow)
222+
set_property(TEST testCcdbDatabaseExtra PROPERTY LABELS manual)
220223

221224
# ---- Install ----
222225

Framework/src/CcdbDatabase.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <utility>
3434
#include <fairlogger/Logger.h>
3535

36+
#include <TSystem.h>
37+
3638
using namespace std::chrono;
3739
using namespace AliceO2::Common;
3840
using namespace o2::quality_control::core;
@@ -54,6 +56,7 @@ void CcdbDatabase::loadDeprecatedStreamerInfos()
5456
TFile file(path.data(), "READ");
5557
if (file.IsZombie()) {
5658
string s = string("Cannot find ") + path;
59+
LOG(ERROR) << s;
5760
BOOST_THROW_EXCEPTION(DatabaseException() << errinfo_details(s));
5861
}
5962
TIter next(file.GetListOfKeys());

Framework/test/testCcdbDatabase.cxx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,6 @@ BOOST_AUTO_TEST_CASE(ccdb_retrieve, *utf::depends_on("ccdb_store"))
9797
BOOST_CHECK_EQUAL(h1->GetEntries(), 10000);
9898
}
9999

100-
BOOST_AUTO_TEST_CASE(ccdb_retrieve_all)
101-
{
102-
test_fixture f;
103-
for (auto const& [task, object] : Objects) {
104-
std::cout << "[RETRIEVE]: " << task << object << std::endl;
105-
auto mo = f.backend->retrieve(task, object);
106-
if (mo == nullptr) {
107-
std::cout << "No object found (" << task << object << ")" << std::endl;
108-
continue;
109-
}
110-
cout << "name of encapsulated object : " << mo->getObject()->GetName() << endl; // just to test it
111-
}
112-
}
113-
114-
BOOST_AUTO_TEST_CASE(ccdb_retrievejson)
115-
{
116-
test_fixture f;
117-
for (auto const& [task, object] : Objects) {
118-
std::cout << "[JSON RETRIEVE]: " << task << "/" << object << std::endl;
119-
auto json = f.backend->retrieveJson(task, object);
120-
if (json.empty()) {
121-
std::cout << "skipping empty object..." << std::endl;
122-
continue;
123-
}
124-
std::stringstream ss;
125-
ss << json;
126-
boost::property_tree::ptree pt;
127-
boost::property_tree::read_json(ss, pt);
128-
}
129-
}
130-
131100
BOOST_AUTO_TEST_CASE(ccdb_retrieve_former_versions, *utf::depends_on("ccdb_store"))
132101
{
133102
// store a new object
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
///
12+
/// \file testCcdbDatabase.cxx
13+
/// \author Adam Wegrzynek
14+
/// \author Bartheley von Haller
15+
///
16+
17+
#include <QualityControl/DatabaseFactory.h>
18+
#include <unordered_map>
19+
#include <QualityControl/CcdbDatabase.h>
20+
21+
#define BOOST_TEST_MODULE CcdbDatabaseExtra test
22+
#define BOOST_TEST_MAIN
23+
#define BOOST_TEST_DYN_LINK
24+
25+
#include <boost/test/unit_test.hpp>
26+
#include <TH1F.h>
27+
#include <TFile.h>
28+
#include <boost/property_tree/ptree.hpp>
29+
#include <boost/property_tree/json_parser.hpp>
30+
31+
namespace utf = boost::unit_test;
32+
33+
namespace o2::quality_control::core
34+
{
35+
36+
namespace
37+
{
38+
39+
using namespace o2::quality_control::core;
40+
using namespace o2::quality_control::repository;
41+
using namespace std;
42+
43+
const std::string CCDB_ENDPOINT = "ccdb-test.cern.ch:8080";
44+
std::unordered_map<std::string, std::string> Objects;
45+
46+
/**
47+
* Fixture for the tests, i.e. code is ran in every test that uses it, i.e. it is like a setup and teardown for tests.
48+
*/
49+
struct test_fixture {
50+
test_fixture()
51+
{
52+
backend = DatabaseFactory::create("CCDB");
53+
backend->connect(CCDB_ENDPOINT, "", "", "");
54+
std::cout << "*** " << boost::unit_test::framework::current_test_case().p_name << " ***" << std::endl;
55+
}
56+
57+
~test_fixture() = default;
58+
59+
std::unique_ptr<DatabaseInterface> backend;
60+
map<string, string> metadata;
61+
};
62+
63+
// These tests should not be executed automatically, too much error prone.
64+
// It depends on what is in the database.
65+
66+
BOOST_AUTO_TEST_CASE(ccdb_retrieve_all)
67+
{
68+
test_fixture f;
69+
for (auto const& [task, object] : Objects) {
70+
std::cout << "[RETRIEVE]: " << task << object << std::endl;
71+
auto mo = f.backend->retrieve(task, object);
72+
if (mo == nullptr) {
73+
std::cout << "No object found (" << task << object << ")" << std::endl;
74+
continue;
75+
}
76+
cout << "name of encapsulated object : " << mo->getObject()->GetName() << endl; // just to test it
77+
}
78+
}
79+
80+
// TODO this should not be executed automatically, too much error prone.
81+
// It depends on what is in the database.
82+
BOOST_AUTO_TEST_CASE(ccdb_retrieve_all_json)
83+
{
84+
test_fixture f;
85+
for (auto const& [task, object] : Objects) {
86+
std::cout << "[JSON RETRIEVE]: " << task << "/" << object << std::endl;
87+
auto json = f.backend->retrieveJson(task, object);
88+
if (json.empty()) {
89+
std::cout << "skipping empty object..." << std::endl;
90+
continue;
91+
}
92+
std::stringstream ss;
93+
ss << json;
94+
boost::property_tree::ptree pt;
95+
boost::property_tree::read_json(ss, pt);
96+
}
97+
}
98+
} // namespace
99+
} // namespace o2::quality_control::core

0 commit comments

Comments
 (0)