Skip to content

Commit b1f7eb9

Browse files
tests: module: fix sonarcloud
zbus_chan_add_obs needs zbus_observer_node argument. Signed-off-by: Giacomo Dematteis <giacomo.dematteis@nordicsemi.no>
1 parent 5a4adcf commit b1f7eb9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/module/cloud/src/cloud_module_test.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ static void cloud_chan_cb(const struct zbus_channel *chan)
110110
}
111111
}
112112

113+
/* Static observer node for zbus */
114+
static struct zbus_observer_node obs_node;
115+
113116
void setUp(void)
114117
{
115118
const struct zbus_channel *chan;
@@ -130,7 +133,7 @@ void setUp(void)
130133
zbus_sub_wait(&led, &chan, K_NO_WAIT);
131134
zbus_sub_wait(&battery, &chan, K_NO_WAIT);
132135

133-
zbus_chan_add_obs(&CLOUD_CHAN, &cloud_test_listener, K_NO_WAIT);
136+
zbus_chan_add_obs(&CLOUD_CHAN, &cloud_test_listener, &obs_node, K_NO_WAIT);
134137
}
135138

136139
void test_initial_transition_to_disconnected(void)

tests/module/cloud_mqtt/src/cloud_mqtt_test.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ static void publish_test_payload(void)
149149
k_sleep(K_MSEC(100));
150150
}
151151

152+
/* Static observer node for zbus */
153+
static struct zbus_observer_node obs_node;
154+
152155
void setUp(void)
153156
{
154157
/* Reset fakes */
@@ -165,7 +168,7 @@ void setUp(void)
165168
hw_id_get_fake.custom_fake = hw_id_get_custom_fake;
166169
mqtt_helper_init_fake.custom_fake = mqtt_helper_init_custom_fake;
167170

168-
zbus_chan_add_obs(&CLOUD_CHAN, &cloud_test_listener, K_NO_WAIT);
171+
zbus_chan_add_obs(&CLOUD_CHAN, &cloud_test_listener, &obs_node, K_NO_WAIT);
169172
}
170173

171174
void tearDown(void)

0 commit comments

Comments
 (0)