Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for cross-site catalog access
- Loading branch information
Showing
8 changed files
with
128 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
FWCore/Services/test/SiteLocalConfigServiceCatalogTester.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "FWCore/Framework/interface/global/EDAnalyzer.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Catalog/interface/SiteLocalConfig.h" | ||
#include "FWCore/Catalog/interface/InputFileCatalog.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
|
||
#include <string> | ||
|
||
namespace edmtest { | ||
class SiteLocalConfigServiceCatalogTester : public edm::global::EDAnalyzer<> { | ||
public: | ||
SiteLocalConfigServiceCatalogTester(const edm::ParameterSet& iPSet); | ||
|
||
void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override {} | ||
}; | ||
|
||
SiteLocalConfigServiceCatalogTester::SiteLocalConfigServiceCatalogTester(const edm::ParameterSet& iPSet) { | ||
std::string const overrideCatalog; | ||
|
||
auto const& files = iPSet.getUntrackedParameter<std::vector<edm::ParameterSet>>("files"); | ||
for (auto const& filePSet : files) { | ||
auto const& fileName = filePSet.getUntrackedParameter<std::string>("file"); | ||
unsigned int catalogIndex = filePSet.getUntrackedParameter<unsigned int>("catalogIndex"); | ||
auto const& expectResult = filePSet.getUntrackedParameter<std::string>("expectResult"); | ||
|
||
edm::InputFileCatalog catalog{std::vector{fileName}, overrideCatalog}; | ||
edm::FileCatalogItem const& item = catalog.fileCatalogItems()[0]; | ||
if (catalogIndex >= item.fileNames().size()) { | ||
throw cms::Exception("Assert") << "Asked catalog " << catalogIndex << " from InputFileCatalog that had only " | ||
<< item.fileNames().size() << " entries"; | ||
} | ||
auto const& result = item.fileName(catalogIndex); | ||
|
||
if (result != expectResult) { | ||
throw cms::Exception("Assert") << "InputFileCatalog gave '" << result << "' for catalog " << catalogIndex | ||
<< ", expected '" << expectResult << "'"; | ||
} | ||
} | ||
} | ||
} // namespace edmtest | ||
|
||
using SiteLocalConfigServiceCatalogTester = edmtest::SiteLocalConfigServiceCatalogTester; | ||
DEFINE_FWK_MODULE(SiteLocalConfigServiceCatalogTester); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<site-local-config> | ||
<site name="DUMMY"> | ||
<event-data> | ||
<catalog url="trivialcatalog_file:/dummy/storage.xml?protocol=dcap"/> | ||
</event-data> | ||
<data-access> | ||
<catalog volume="LocalVolume" protocol="XRootD"/> | ||
<catalog site="DUMMY_CROSS_SITE" volume="CMSXrootdFederation" protocol="XRootD"/> | ||
</data-access> | ||
<local-stage-out> | ||
<se-name value="cmssrm.dummy.foo"/> | ||
<command value="srm"/> | ||
<catalog url="trivialcatalog_file:/dummy/storage.xml?protocol=srm"/> | ||
</local-stage-out> | ||
<calib-data> | ||
<frontier-connect> | ||
<proxy url="http://cmsfrontier.dummy.foo:3128"/> | ||
<proxy url="http://cmsfrontier.dummy.foo:3128"/> | ||
</frontier-connect> | ||
</calib-data> | ||
</site> | ||
</site-local-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ "site": "DUMMY", | ||
"volume": "LocalVolume", | ||
"protocols": [ | ||
{ "protocol": "XRootD", | ||
"access": "global-rw", | ||
"comment": "xrootd write to dCache/EOS endpoint directly", | ||
"rules": [ | ||
{ "lfn": "/+store/temp/user/(.*)", | ||
"pfn": "root://cmseos.fnal.gov//eos/uscms/store/temp/user/$1" | ||
}, | ||
{ "lfn": "/+store/(.*)", | ||
"pfn": "root://cmsdcadisk.fnal.gov//dcache/uscmsdisk/store/$1" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{ "site": "DUMMY_CROSS_SITE", | ||
"volume": "CMSXrootdFederation", | ||
"protocols": [ | ||
{ "protocol": "XRootD", | ||
"access": "global-ro", | ||
"prefix": "root://xrootd-cms.infn.it/" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
process = cms.Process("TEST") | ||
|
||
process.source = cms.Source("EmptySource") | ||
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) | ||
|
||
process.tester = cms.EDAnalyzer("SiteLocalConfigServiceCatalogTester", | ||
files = cms.untracked.VPSet( | ||
cms.untracked.PSet( | ||
file = cms.untracked.string("/store/a/b.root"), | ||
catalogIndex = cms.untracked.uint32(0), | ||
expectResult = cms.untracked.string("root://cmsdcadisk.fnal.gov//dcache/uscmsdisk/store/a/b.root") | ||
), | ||
cms.untracked.PSet( | ||
file = cms.untracked.string("/store/a/b.root"), | ||
catalogIndex = cms.untracked.uint32(1), | ||
expectResult = cms.untracked.string("root://xrootd-cms.infn.it//store/a/b.root") | ||
), | ||
) | ||
) | ||
|
||
process.o = cms.EndPath(process.tester) |