Skip to content

Commit

Permalink
disable tests if no nodes configured
Browse files Browse the repository at this point in the history
  • Loading branch information
benzfield committed Aug 20, 2023
1 parent eb81de5 commit ebcacc5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,39 @@ int main(int argc, char **argv) {
#if ENABLE_OPENTELEMETRY_API
//initMetrics();
#endif
std::string filterString;
std::vector<std::string> hsmConn =
::hsmc::SessionFactory::instance().getConnectorNames(::hsmc::ConnectorType::CT_HSM);
if (hsmConn.size() == 0) {
if (filterString.size() > 0) {
filterString += ":";
}
filterString += "SessionPoolTest.*:SessionTest.*";
std::cerr << "WARN: No HSM nodes configured, disable SessionPoolTest.* and SessionTest.*"
<< std::endl;
}
std::vector<std::string> svsConn =
::hsmc::SessionFactory::instance().getConnectorNames(::hsmc::ConnectorType::CT_SVS);
if (svsConn.size() == 0) {
if (filterString.size() > 0) {
filterString += ":";
}
filterString += "SVSSessionTest.*";
std::cerr << "WARN: No SVS nodes configured, disable SVSSessionTest.*"
<< std::endl;
}
std::vector<std::string> tssConn =
::hsmc::SessionFactory::instance().getConnectorNames(::hsmc::ConnectorType::CT_TSS);
if (tssConn.size() == 0) {
if (filterString.size() > 0) {
filterString += ":";
}
filterString += "TSSSessionTest.*";
std::cerr << "WARN: No TSS nodes configured, disable TSSSessionTest.*"
<< std::endl;
}

::testing::GTEST_FLAG(filter) = "-"+filterString;

int rc = RUN_ALL_TESTS();

Expand Down

0 comments on commit ebcacc5

Please sign in to comment.