Skip to content

Commit d98cc80

Browse files
authored
add a test for the retrieval of headers from ccdb (#3502)
* add a test for the retrieval of headers from ccdb
1 parent 17d733d commit d98cc80

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

CCDB/test/testCcdbApi.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,27 @@ BOOST_AUTO_TEST_CASE(timestamptest, *utf::precondition(if_reachable()))
239239
BOOST_CHECK(pupper == nullptr);
240240
}
241241

242+
BOOST_AUTO_TEST_CASE(retrieveTemplatedWithHeaders, *utf::precondition(if_reachable()))
243+
{
244+
test_fixture f;
245+
246+
// first store something
247+
o2::ccdb::IdPath path;
248+
path.setPath("HelloWorld");
249+
long from = o2::ccdb::getCurrentTimestamp();
250+
long to = o2::ccdb::getFutureTimestamp(60 * 60 * 24 * 365 * 10);
251+
f.api.storeAsTFileAny(&path, basePath + "CCDBPathUnitTest", f.metadata, from, to);
252+
253+
// then try to retrieve, including the headers
254+
std::map<std::string, std::string> headers;
255+
std::map<std::string, std::string> meta;
256+
cout << "basePath + \"CCDBPathUnitTest\" : " << basePath + "CCDBPathUnitTest" << endl;
257+
cout << "from+1 : " << from + 1 << endl;
258+
auto* object = f.api.retrieveFromTFileAny<o2::ccdb::IdPath>(basePath + "CCDBPathUnitTest", meta, from + 1, &headers);
259+
BOOST_CHECK(headers.count("Hello") == 1);
260+
BOOST_CHECK(headers["Hello"] == "World");
261+
}
262+
242263
BOOST_AUTO_TEST_CASE(retrieveTMemFile_test, *utf::precondition(if_reachable()))
243264
{
244265
test_fixture f;

0 commit comments

Comments
 (0)