hardware: push alarm-inventory alarms in one batch
This reduces the first initial push to alarm-inventory from 4 edits to
1.
What a simple diff in src/ and what a mess under tests/.
Change-Id: I07f38e529341f2bcdcc51e2e9562b641971c553e
diff --git a/tests/health_systemd-units.cpp b/tests/health_systemd-units.cpp
index 5eaf354..da880df 100644
--- a/tests/health_systemd-units.cpp
+++ b/tests/health_systemd-units.cpp
@@ -21,6 +21,7 @@
using namespace std::chrono_literals;
+#define VEC(...) (std::vector<std::string>{__VA_ARGS__})
#define REQUIRE_NEW_ALARM_INVENTORY_UNIT(UNIT) \
REQUIRE_NEW_ALARM_INVENTORY_RESOURCES(alarmsWatcher, (std::vector<std::string>{"velia-alarms:systemd-unit-failure"}), std::vector<std::string>{UNIT})
@@ -46,12 +47,13 @@
client.switchDatastore(sysrepo::Datastore::Operational);
AlarmWatcher alarmsWatcher(client);
- REQUIRE_NEW_ALARM_INVENTORY_ENTRY(alarmsWatcher,
- "velia-alarms:systemd-unit-failure",
- (std::vector<std::string>{"unit1.service", "unit2.service", "unit3.service"}),
- (std::vector<std::string>{"critical"}),
- true,
- "The systemd service is considered in failed state.");
+ REQUIRE_NEW_ALARM_INVENTORY_ENTRIES(alarmsWatcher,
+ (std::vector<velia::alarms::AlarmInventoryEntry>{{
+ "velia-alarms:systemd-unit-failure",
+ "The systemd service is considered in failed state.",
+ VEC("unit1.service", "unit2.service", "unit3.service"),
+ VEC("critical"),
+ }}));
REQUIRE_ALARM_RPC("unit1.service", "cleared", "systemd unit state: (active, running)");
server.createUnit(*serverConnection, "unit1.service", "/org/freedesktop/systemd1/unit/unit1", "active", "running");