1 #include "dbus_environment.hpp" 2 #include "helpers.hpp" 3 #include "messages/collect_trigger_id.hpp" 4 #include "messages/trigger_presence_changed_ind.hpp" 5 #include "mocks/json_storage_mock.hpp" 6 #include "mocks/report_manager_mock.hpp" 7 #include "mocks/sensor_mock.hpp" 8 #include "mocks/threshold_mock.hpp" 9 #include "mocks/trigger_factory_mock.hpp" 10 #include "mocks/trigger_manager_mock.hpp" 11 #include "params/trigger_params.hpp" 12 #include "trigger.hpp" 13 #include "trigger_manager.hpp" 14 #include "utils/conversion_trigger.hpp" 15 #include "utils/dbus_path_utils.hpp" 16 #include "utils/messanger.hpp" 17 #include "utils/string_utils.hpp" 18 #include "utils/transform.hpp" 19 #include "utils/tstring.hpp" 20 21 #include <boost/range/combine.hpp> 22 23 using namespace testing; 24 using namespace std::literals::string_literals; 25 using sdbusplus::message::object_path; 26 27 static constexpr size_t expectedTriggerVersion = 2; 28 29 class TestTrigger : public Test 30 { 31 public: 32 TriggerParams triggerParams; 33 TriggerParams triggerDiscreteParams = 34 TriggerParams() 35 .id("DiscreteTrigger") 36 .name("My Discrete Trigger") 37 .thresholdParams(std::vector<discrete::LabeledThresholdParam>{ 38 discrete::LabeledThresholdParam{ 39 "userId", discrete::Severity::warning, 40 Milliseconds(10).count(), "15.2"}, 41 discrete::LabeledThresholdParam{ 42 "userId_2", discrete::Severity::critical, 43 Milliseconds(5).count(), "32.7"}, 44 }); 45 46 std::unique_ptr<ReportManagerMock> reportManagerMockPtr = 47 std::make_unique<NiceMock<ReportManagerMock>>(); 48 std::unique_ptr<TriggerManagerMock> triggerManagerMockPtr = 49 std::make_unique<NiceMock<TriggerManagerMock>>(); 50 std::unique_ptr<TriggerFactoryMock> triggerFactoryMockPtr = 51 std::make_unique<NiceMock<TriggerFactoryMock>>(); 52 testing::NiceMock<StorageMock> storageMock; 53 NiceMock<MockFunction<void(const messages::TriggerPresenceChangedInd)>> 54 triggerPresenceChanged; 55 std::vector<std::shared_ptr<interfaces::Threshold>> thresholdMocks; 56 utils::Messanger messanger; 57 std::unique_ptr<Trigger> sut; 58 59 TestTrigger() : messanger(DbusEnvironment::getIoc()) 60 { 61 messanger.on_receive<messages::TriggerPresenceChangedInd>( 62 [this](const auto& msg) { triggerPresenceChanged.Call(msg); }); 63 } 64 65 void SetUp() override 66 { 67 sut = makeTrigger(triggerParams); 68 } 69 70 static std::vector<LabeledSensorInfo> 71 convertToLabeledSensor(const SensorsInfo& sensorsInfo) 72 { 73 return utils::transform(sensorsInfo, [](const auto& sensorInfo) { 74 const auto& [sensorPath, sensorMetadata] = sensorInfo; 75 return LabeledSensorInfo("service1", sensorPath, sensorMetadata); 76 }); 77 } 78 79 std::unique_ptr<Trigger> makeTrigger(const TriggerParams& params) 80 { 81 thresholdMocks = 82 ThresholdMock::makeThresholds(params.thresholdParams()); 83 84 auto id = std::make_unique<const std::string>(params.id()); 85 86 return std::make_unique<Trigger>( 87 DbusEnvironment::getIoc(), DbusEnvironment::getObjServer(), 88 std::move(id), params.name(), params.triggerActions(), 89 std::make_shared<std::vector<std::string>>( 90 params.reportIds().begin(), params.reportIds().end()), 91 std::vector<std::shared_ptr<interfaces::Threshold>>(thresholdMocks), 92 *triggerManagerMockPtr, storageMock, *triggerFactoryMockPtr, 93 SensorMock::makeSensorMocks(params.sensors())); 94 } 95 96 static interfaces::JsonStorage::FilePath to_file_path(std::string name) 97 { 98 return interfaces::JsonStorage::FilePath( 99 std::to_string(std::hash<std::string>{}(name))); 100 } 101 102 template <class T> 103 static T getProperty(const std::string& path, const std::string& property) 104 { 105 return DbusEnvironment::getProperty<T>(path, Trigger::triggerIfaceName, 106 property); 107 } 108 109 template <class T> 110 static boost::system::error_code setProperty(const std::string& path, 111 const std::string& property, 112 const T& newValue) 113 { 114 return DbusEnvironment::setProperty<T>(path, Trigger::triggerIfaceName, 115 property, newValue); 116 } 117 118 template <class T> 119 struct ChangePropertyParams 120 { 121 Matcher<T> valueBefore = _; 122 T newValue; 123 Matcher<boost::system::error_code> ec = 124 Eq(boost::system::errc::success); 125 Matcher<T> valueAfter = Eq(newValue); 126 }; 127 128 template <class T> 129 static void changeProperty(const std::string& path, 130 const std::string& property, 131 ChangePropertyParams<T> p) 132 { 133 ASSERT_THAT(getProperty<T>(path, property), p.valueBefore); 134 ASSERT_THAT(setProperty<T>(path, property, p.newValue), p.ec); 135 EXPECT_THAT(getProperty<T>(path, property), p.valueAfter); 136 } 137 138 boost::system::error_code deleteTrigger(const std::string& path) 139 { 140 std::promise<boost::system::error_code> methodPromise; 141 DbusEnvironment::getBus()->async_method_call( 142 [&methodPromise](boost::system::error_code ec) { 143 methodPromise.set_value(ec); 144 }, DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName, 145 "Delete"); 146 return DbusEnvironment::waitForFuture(methodPromise.get_future()); 147 } 148 }; 149 150 TEST_F(TestTrigger, checkIfPropertiesAreSet) 151 { 152 EXPECT_THAT(getProperty<std::string>(sut->getPath(), "Name"), 153 Eq(triggerParams.name())); 154 EXPECT_THAT(getProperty<bool>(sut->getPath(), "Persistent"), Eq(true)); 155 EXPECT_THAT( 156 getProperty<std::vector<std::string>>(sut->getPath(), "TriggerActions"), 157 Eq(utils::transform( 158 triggerParams.triggerActions(), 159 [](const auto& action) { return actionToString(action); }))); 160 EXPECT_THAT((getProperty<SensorsInfo>(sut->getPath(), "Sensors")), 161 Eq(utils::fromLabeledSensorsInfo(triggerParams.sensors()))); 162 EXPECT_THAT( 163 getProperty<std::vector<object_path>>(sut->getPath(), "Reports"), 164 Eq(triggerParams.reports())); 165 EXPECT_THAT( 166 getProperty<bool>(sut->getPath(), "Discrete"), 167 Eq(isTriggerThresholdDiscrete(triggerParams.thresholdParams()))); 168 EXPECT_THAT( 169 getProperty<TriggerThresholdParams>(sut->getPath(), "Thresholds"), 170 Eq(std::visit(utils::FromLabeledThresholdParamConversion(), 171 triggerParams.thresholdParams()))); 172 } 173 174 TEST_F(TestTrigger, checkBasicGetters) 175 { 176 EXPECT_THAT(sut->getId(), Eq(triggerParams.id())); 177 EXPECT_THAT(sut->getPath(), 178 Eq(utils::constants::triggerDirPath.str + triggerParams.id())); 179 } 180 181 TEST_F(TestTrigger, setPropertyNameToCorrectValue) 182 { 183 std::string name = "custom name 1234 %^#5"; 184 EXPECT_THAT(setProperty(sut->getPath(), "Name", name), 185 Eq(boost::system::errc::success)); 186 EXPECT_THAT(getProperty<std::string>(sut->getPath(), "Name"), Eq(name)); 187 } 188 189 TEST_F(TestTrigger, setPropertyReportNames) 190 { 191 std::vector<object_path> newNames = { 192 utils::constants::reportDirPath / "abc", 193 utils::constants::reportDirPath / "one", 194 utils::constants::reportDirPath / "prefix" / "two"}; 195 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newNames), 196 Eq(boost::system::errc::success)); 197 EXPECT_THAT( 198 getProperty<std::vector<object_path>>(sut->getPath(), "Reports"), 199 Eq(newNames)); 200 } 201 202 TEST_F(TestTrigger, sendsUpdateWhenReportNamesChanges) 203 { 204 std::vector<object_path> newPropertyVal = { 205 utils::constants::reportDirPath / "abc", 206 utils::constants::reportDirPath / "one", 207 utils::constants::reportDirPath / "two"}; 208 209 EXPECT_CALL(triggerPresenceChanged, 210 Call(FieldsAre(messages::Presence::Exist, triggerParams.id(), 211 UnorderedElementsAre("abc", "one", "two")))); 212 213 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 214 Eq(boost::system::errc::success)); 215 } 216 217 TEST_F(TestTrigger, sendsUpdateWhenReportNamesChangesToSameValue) 218 { 219 const std::vector<object_path> newPropertyVal = triggerParams.reports(); 220 221 EXPECT_CALL( 222 triggerPresenceChanged, 223 Call(FieldsAre(messages::Presence::Exist, triggerParams.id(), 224 UnorderedElementsAreArray(triggerParams.reportIds())))); 225 226 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 227 Eq(boost::system::errc::success)); 228 } 229 230 TEST_F(TestTrigger, 231 DISABLED_settingPropertyReportNamesThrowsExceptionWhenDuplicateReportIds) 232 { 233 std::vector<object_path> newPropertyVal{ 234 utils::constants::reportDirPath / "report1", 235 utils::constants::reportDirPath / "report2", 236 utils::constants::reportDirPath / "report1"}; 237 238 EXPECT_CALL(triggerPresenceChanged, Call(_)).Times(0); 239 240 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 241 Eq(boost::system::errc::invalid_argument)); 242 } 243 244 TEST_F( 245 TestTrigger, 246 DISABLED_settingPropertyReportNamesThrowsExceptionWhenReportWithTooManyPrefixes) 247 { 248 std::vector<object_path> newPropertyVal{ 249 object_path("/xyz/openbmc_project/Telemetry/Reports/P1/P2/MyReport")}; 250 251 EXPECT_CALL(triggerPresenceChanged, Call(_)).Times(0); 252 253 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 254 Eq(boost::system::errc::invalid_argument)); 255 } 256 257 TEST_F( 258 TestTrigger, 259 DISABLED_settingPropertyReportNamesThrowsExceptionWhenReportWithTooLongPrefix) 260 { 261 std::vector<object_path> newPropertyVal{ 262 object_path("/xyz/openbmc_project/Telemetry/Reports/" + 263 utils::string_utils::getTooLongPrefix() + "/MyReport")}; 264 265 EXPECT_CALL(triggerPresenceChanged, Call(_)).Times(0); 266 267 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 268 Eq(boost::system::errc::invalid_argument)); 269 } 270 271 TEST_F( 272 TestTrigger, 273 DISABLED_settingPropertyReportNamesThrowsExceptionWhenReportWithTooLongId) 274 { 275 std::vector<object_path> newPropertyVal{ 276 object_path("/xyz/openbmc_project/Telemetry/Reports/Prefix/" + 277 utils::string_utils::getTooLongId())}; 278 279 EXPECT_CALL(triggerPresenceChanged, Call(_)).Times(0); 280 281 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 282 Eq(boost::system::errc::invalid_argument)); 283 } 284 285 TEST_F(TestTrigger, 286 DISABLED_settingPropertyReportNamesThrowsExceptionWhenReportWithBadPath) 287 { 288 std::vector<object_path> newPropertyVal{ 289 object_path("/xyz/openbmc_project/Telemetry/NotReports/MyReport")}; 290 291 EXPECT_CALL(triggerPresenceChanged, Call(_)).Times(0); 292 293 EXPECT_THAT(setProperty(sut->getPath(), "Reports", newPropertyVal), 294 Eq(boost::system::errc::invalid_argument)); 295 } 296 297 TEST_F(TestTrigger, setPropertySensors) 298 { 299 EXPECT_CALL(*triggerFactoryMockPtr, updateSensors(_, _)); 300 for (const auto& threshold : thresholdMocks) 301 { 302 auto thresholdMockPtr = 303 std::dynamic_pointer_cast<NiceMock<ThresholdMock>>(threshold); 304 EXPECT_CALL(*thresholdMockPtr, updateSensors(_)); 305 } 306 SensorsInfo newSensors( 307 {std::make_pair(object_path("/abc/def"), "metadata")}); 308 EXPECT_THAT(setProperty(sut->getPath(), "Sensors", newSensors), 309 Eq(boost::system::errc::success)); 310 } 311 312 TEST_F(TestTrigger, setPropertyThresholds) 313 { 314 EXPECT_CALL(*triggerFactoryMockPtr, updateThresholds(_, _, _, _, _, _)); 315 TriggerThresholdParams newThresholds = 316 std::vector<discrete::ThresholdParam>({std::make_tuple( 317 "discrete threshold", utils::enumToString(discrete::Severity::ok), 318 10, "12.3")}); 319 EXPECT_THAT(setProperty(sut->getPath(), "Thresholds", newThresholds), 320 Eq(boost::system::errc::success)); 321 } 322 323 TEST_F(TestTrigger, setThresholdParamsWithTooLongDiscreteName) 324 { 325 const TriggerThresholdParams currentValue = 326 std::visit(utils::FromLabeledThresholdParamConversion(), 327 triggerParams.thresholdParams()); 328 329 TriggerThresholdParams newThresholds = 330 std::vector<discrete::ThresholdParam>({std::make_tuple( 331 utils::string_utils::getTooLongName(), 332 utils::enumToString(discrete::Severity::ok), 10, "12.3")}); 333 334 changeProperty<TriggerThresholdParams>( 335 sut->getPath(), "Thresholds", 336 {.valueBefore = Eq(currentValue), 337 .newValue = newThresholds, 338 .ec = Eq(boost::system::errc::invalid_argument), 339 .valueAfter = Eq(currentValue)}); 340 } 341 342 TEST_F(TestTrigger, setNameTooLong) 343 { 344 std::string currentValue = TriggerParams().name(); 345 346 changeProperty<std::string>( 347 sut->getPath(), "Name", 348 {.valueBefore = Eq(currentValue), 349 .newValue = utils::string_utils::getTooLongName(), 350 .ec = Eq(boost::system::errc::invalid_argument), 351 .valueAfter = Eq(currentValue)}); 352 } 353 354 TEST_F(TestTrigger, checkIfNumericCoversionsAreGood) 355 { 356 const auto& labeledParamsBase = 357 std::get<std::vector<numeric::LabeledThresholdParam>>( 358 triggerParams.thresholdParams()); 359 const auto paramsToCheck = 360 std::visit(utils::FromLabeledThresholdParamConversion(), 361 triggerParams.thresholdParams()); 362 const auto labeledParamsToCheck = 363 std::get<std::vector<numeric::LabeledThresholdParam>>(std::visit( 364 utils::ToLabeledThresholdParamConversion(), paramsToCheck)); 365 366 for (const auto& [tocheck, base] : 367 boost::combine(labeledParamsToCheck, labeledParamsBase)) 368 { 369 EXPECT_THAT(tocheck.at_label<utils::tstring::Type>(), 370 Eq(base.at_label<utils::tstring::Type>())); 371 EXPECT_THAT(tocheck.at_label<utils::tstring::Direction>(), 372 Eq(base.at_label<utils::tstring::Direction>())); 373 EXPECT_THAT(tocheck.at_label<utils::tstring::DwellTime>(), 374 Eq(base.at_label<utils::tstring::DwellTime>())); 375 EXPECT_THAT(tocheck.at_label<utils::tstring::ThresholdValue>(), 376 Eq(base.at_label<utils::tstring::ThresholdValue>())); 377 } 378 } 379 380 TEST_F(TestTrigger, checkIfDiscreteCoversionsAreGood) 381 { 382 const auto& labeledParamsBase = 383 std::get<std::vector<discrete::LabeledThresholdParam>>( 384 triggerDiscreteParams.thresholdParams()); 385 const auto paramsToCheck = 386 std::visit(utils::FromLabeledThresholdParamConversion(), 387 triggerDiscreteParams.thresholdParams()); 388 const auto labeledParamsToCheck = 389 std::get<std::vector<discrete::LabeledThresholdParam>>(std::visit( 390 utils::ToLabeledThresholdParamConversion(), paramsToCheck)); 391 392 for (const auto& [tocheck, base] : 393 boost::combine(labeledParamsToCheck, labeledParamsBase)) 394 { 395 EXPECT_THAT(tocheck.at_label<utils::tstring::UserId>(), 396 Eq(base.at_label<utils::tstring::UserId>())); 397 EXPECT_THAT(tocheck.at_label<utils::tstring::Severity>(), 398 Eq(base.at_label<utils::tstring::Severity>())); 399 EXPECT_THAT(tocheck.at_label<utils::tstring::DwellTime>(), 400 Eq(base.at_label<utils::tstring::DwellTime>())); 401 EXPECT_THAT(tocheck.at_label<utils::tstring::ThresholdValue>(), 402 Eq(base.at_label<utils::tstring::ThresholdValue>())); 403 } 404 } 405 406 TEST_F(TestTrigger, deleteTrigger) 407 { 408 EXPECT_CALL(storageMock, remove(to_file_path(sut->getId()))); 409 EXPECT_CALL(*triggerManagerMockPtr, removeTrigger(sut.get())); 410 411 auto ec = deleteTrigger(sut->getPath()); 412 EXPECT_THAT(ec, Eq(boost::system::errc::success)); 413 } 414 415 TEST_F(TestTrigger, sendUpdateWhenTriggerIsDeleted) 416 { 417 EXPECT_CALL(triggerPresenceChanged, 418 Call(FieldsAre(messages::Presence::Removed, triggerParams.id(), 419 UnorderedElementsAre()))); 420 421 auto ec = deleteTrigger(sut->getPath()); 422 EXPECT_THAT(ec, Eq(boost::system::errc::success)); 423 } 424 425 TEST_F(TestTrigger, deletingNonExistingTriggerReturnInvalidRequestDescriptor) 426 { 427 auto ec = 428 deleteTrigger(utils::constants::triggerDirPath.str + "NonExisting"s); 429 EXPECT_THAT(ec.value(), Eq(EBADR)); 430 } 431 432 TEST_F(TestTrigger, settingPersistencyToFalseRemovesTriggerFromStorage) 433 { 434 EXPECT_CALL(storageMock, remove(to_file_path(sut->getId()))); 435 436 bool persistent = false; 437 EXPECT_THAT(setProperty(sut->getPath(), "Persistent", persistent), 438 Eq(boost::system::errc::success)); 439 EXPECT_THAT(getProperty<bool>(sut->getPath(), "Persistent"), 440 Eq(persistent)); 441 } 442 443 class TestTriggerInitialization : public TestTrigger 444 { 445 public: 446 void SetUp() override {} 447 448 nlohmann::json storedConfiguration; 449 }; 450 451 TEST_F(TestTriggerInitialization, 452 exceptionDuringTriggerStoreDisablesPersistency) 453 { 454 EXPECT_CALL(storageMock, store(_, _)) 455 .WillOnce(Throw(std::runtime_error("Generic error!"))); 456 457 sut = makeTrigger(triggerParams); 458 459 EXPECT_THAT(getProperty<bool>(sut->getPath(), "Persistent"), Eq(false)); 460 } 461 462 TEST_F(TestTriggerInitialization, creatingTriggerThrowsExceptionWhenIdIsInvalid) 463 { 464 EXPECT_CALL(storageMock, store(_, _)).Times(0); 465 466 EXPECT_THROW(makeTrigger(triggerParams.id("inv?lidId")), 467 sdbusplus::exception::SdBusError); 468 } 469 470 TEST_F(TestTriggerInitialization, creatingTriggerUpdatesTriggersIdsInReports) 471 { 472 EXPECT_CALL( 473 triggerPresenceChanged, 474 Call(FieldsAre(messages::Presence::Exist, triggerParams.id(), 475 UnorderedElementsAreArray(triggerParams.reportIds())))); 476 477 sut = makeTrigger(triggerParams); 478 } 479 480 class TestTriggerStore : public TestTrigger 481 { 482 public: 483 nlohmann::json storedConfiguration; 484 nlohmann::json storedDiscreteConfiguration; 485 std::unique_ptr<Trigger> sutDiscrete; 486 487 void SetUp() override 488 { 489 ON_CALL(storageMock, store(_, _)) 490 .WillByDefault(SaveArg<1>(&storedConfiguration)); 491 sut = makeTrigger(triggerParams); 492 493 ON_CALL(storageMock, store(_, _)) 494 .WillByDefault(SaveArg<1>(&storedDiscreteConfiguration)); 495 sutDiscrete = makeTrigger(triggerDiscreteParams); 496 } 497 }; 498 499 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerVersion) 500 { 501 ASSERT_THAT(storedConfiguration.at("Version"), Eq(expectedTriggerVersion)); 502 } 503 504 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerId) 505 { 506 ASSERT_THAT(storedConfiguration.at("Id"), Eq(triggerParams.id())); 507 } 508 509 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerName) 510 { 511 ASSERT_THAT(storedConfiguration.at("Name"), Eq(triggerParams.name())); 512 } 513 514 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerTriggerActions) 515 { 516 ASSERT_THAT(storedConfiguration.at("TriggerActions"), 517 Eq(utils::transform(triggerParams.triggerActions(), 518 [](const auto& action) { 519 return actionToString(action); 520 }))); 521 } 522 523 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerReportIds) 524 { 525 ASSERT_THAT(storedConfiguration.at("ReportIds"), 526 Eq(triggerParams.reportIds())); 527 } 528 529 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerSensors) 530 { 531 nlohmann::json expectedItem; 532 expectedItem["service"] = "service1"; 533 expectedItem["path"] = "/xyz/openbmc_project/sensors/temperature/BMC_Temp"; 534 expectedItem["metadata"] = "metadata1"; 535 536 ASSERT_THAT(storedConfiguration.at("Sensors"), ElementsAre(expectedItem)); 537 } 538 539 TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerThresholdParams) 540 { 541 nlohmann::json expectedItem0; 542 expectedItem0["type"] = 0; 543 expectedItem0["dwellTime"] = 10; 544 expectedItem0["direction"] = 1; 545 expectedItem0["thresholdValue"] = 0.5; 546 547 nlohmann::json expectedItem1; 548 expectedItem1["type"] = 3; 549 expectedItem1["dwellTime"] = 10; 550 expectedItem1["direction"] = 2; 551 expectedItem1["thresholdValue"] = 90.2; 552 553 ASSERT_THAT(storedConfiguration.at("ThresholdParamsDiscriminator"), Eq(0)); 554 ASSERT_THAT(storedConfiguration.at("ThresholdParams"), 555 ElementsAre(expectedItem0, expectedItem1)); 556 } 557 558 TEST_F(TestTriggerStore, 559 settingPersistencyToTrueStoresDiscreteTriggerThresholdParams) 560 { 561 nlohmann::json expectedItem0; 562 expectedItem0["userId"] = "userId"; 563 expectedItem0["severity"] = discrete::Severity::warning; 564 expectedItem0["dwellTime"] = 10; 565 expectedItem0["thresholdValue"] = "15.2"; 566 567 nlohmann::json expectedItem1; 568 expectedItem1["userId"] = "userId_2"; 569 expectedItem1["severity"] = discrete::Severity::critical; 570 expectedItem1["dwellTime"] = 5; 571 expectedItem1["thresholdValue"] = "32.7"; 572 573 ASSERT_THAT(storedDiscreteConfiguration.at("ThresholdParamsDiscriminator"), 574 Eq(1)); 575 ASSERT_THAT(storedDiscreteConfiguration.at("ThresholdParams"), 576 ElementsAre(expectedItem0, expectedItem1)); 577 } 578