@@ -207,6 +207,82 @@ BOOST_AUTO_TEST_CASE(MultinodeUtilities)
207207 auto machines = DataSampling::MachinesForPolicy (configFilePath, " tpcraw" );
208208 BOOST_CHECK_EQUAL (machines.size (), 2 );
209209 }
210+ {
211+ // empty host -> match any policy
212+ WorkflowSpec workflow;
213+ DataSampling::GenerateInfrastructure (workflow, configFilePath, 1 , " " );
214+
215+ auto disp = std::find_if (workflow.begin (), workflow.end (),
216+ [](const DataProcessorSpec& d) {
217+ return d.name .find (" Dispatcher" ) != std::string::npos;
218+ });
219+ BOOST_REQUIRE (disp != workflow.end ());
220+
221+ auto input1 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
222+ [](const InputSpec& in) {
223+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" CLUSTERS" ), 0 ) && in.lifetime == Lifetime::Timeframe;
224+ });
225+ BOOST_CHECK (input1 != disp->inputs .end ());
226+ auto input2 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
227+ [](const InputSpec& in) {
228+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" CLUSTERS_P" ), 0 ) && in.lifetime == Lifetime::Timeframe;
229+ });
230+ BOOST_CHECK (input2 != disp->inputs .end ());
231+ auto input3 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
232+ [](const InputSpec& in) {
233+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" RAWDATA" ), 0 ) && in.lifetime == Lifetime::Timeframe;
234+ });
235+ BOOST_CHECK (input3 != disp->inputs .end ());
236+ }
237+ {
238+ // mismatching host -> create only policies with empty machines list
239+ WorkflowSpec workflow;
240+ DataSampling::GenerateInfrastructure (workflow, configFilePath, 1 , " mismatching host" );
241+
242+ auto disp = std::find_if (workflow.begin (), workflow.end (),
243+ [](const DataProcessorSpec& d) {
244+ return d.name .find (" Dispatcher" ) != std::string::npos;
245+ });
246+ BOOST_REQUIRE (disp != workflow.end ());
247+
248+ auto input1 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
249+ [](const InputSpec& in) {
250+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" CLUSTERS" ), 0 ) && in.lifetime == Lifetime::Timeframe;
251+ });
252+ BOOST_CHECK (input1 != disp->inputs .end ());
253+ auto input2 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
254+ [](const InputSpec& in) {
255+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" CLUSTERS_P" ), 0 ) && in.lifetime == Lifetime::Timeframe;
256+ });
257+ BOOST_CHECK (input2 != disp->inputs .end ());
258+ }
259+ {
260+ // matching host -> create policies with empty machines list and the ones which match
261+ WorkflowSpec workflow;
262+ DataSampling::GenerateInfrastructure (workflow, configFilePath, 1 , " machineA" );
263+
264+ auto disp = std::find_if (workflow.begin (), workflow.end (),
265+ [](const DataProcessorSpec& d) {
266+ return d.name .find (" Dispatcher" ) != std::string::npos;
267+ });
268+ BOOST_REQUIRE (disp != workflow.end ());
269+
270+ auto input1 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
271+ [](const InputSpec& in) {
272+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" CLUSTERS" ), 0 ) && in.lifetime == Lifetime::Timeframe;
273+ });
274+ BOOST_CHECK (input1 != disp->inputs .end ());
275+ auto input2 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
276+ [](const InputSpec& in) {
277+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" CLUSTERS_P" ), 0 ) && in.lifetime == Lifetime::Timeframe;
278+ });
279+ BOOST_CHECK (input2 != disp->inputs .end ());
280+ auto input3 = std::find_if (disp->inputs .begin (), disp->inputs .end (),
281+ [](const InputSpec& in) {
282+ return DataSpecUtils::match (in, DataOrigin (" TPC" ), DataDescription (" RAWDATA" ), 0 ) && in.lifetime == Lifetime::Timeframe;
283+ });
284+ BOOST_CHECK (input3 != disp->inputs .end ());
285+ }
210286}
211287
212288BOOST_AUTO_TEST_CASE (DataSamplingEmptyConfig)
0 commit comments