summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-11-11 22:40:17 +0100
committerLubomir Rintel <lkundrak@v3.sk>2022-11-13 15:25:16 +0100
commit8b3cb0dabf5e8a04d9a8e6fa0e67acf327034cad (patch)
treebe6cbb269c131d63b25cc148540100c128036070
parentd3490a92db2f74a457491d0275778741bf78e8d6 (diff)
libnm/client/test: test cleanup on service shutdown
Currently we assert that properties are reset on client teardown. That is not the right thing to do and we're not going to do that in future. However, what is important to test is that the properties are reset when the daemon goes away. Test that.
-rw-r--r--src/libnm-client-impl/tests/test-nm-client.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/libnm-client-impl/tests/test-nm-client.c b/src/libnm-client-impl/tests/test-nm-client.c
index de43daa18e..c97d9e263f 100644
--- a/src/libnm-client-impl/tests/test-nm-client.c
+++ b/src/libnm-client-impl/tests/test-nm-client.c
@@ -891,9 +891,8 @@ _dev_eth0_1_state_changed_cb(NMDevice *device,
g_assert(!nm_device_get_active_connection(device));
}
-
static void
-test_activate_virtual_teardown(void)
+test_activate_virtual_teardown(gconstpointer user_data)
{
nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
gs_unref_object NMClient *client = NULL;
@@ -901,8 +900,9 @@ test_activate_virtual_teardown(void)
NMActiveConnection *ac;
const GPtrArray *arr;
gulong sig_id;
- int call_count = 0;
- gboolean take_ref = nmtst_get_rand_bool();
+ int call_count = 0;
+ gboolean take_ref = nmtst_get_rand_bool();
+ gboolean teardown_service = GPOINTER_TO_INT(user_data);
if (nmtst_test_skip_slow())
return;
@@ -933,7 +933,12 @@ test_activate_virtual_teardown(void)
G_CALLBACK(_dev_eth0_1_state_changed_cb),
&call_count);
- g_clear_object(&client);
+ if (teardown_service) {
+ nmtstc_service_cleanup(g_steal_pointer(&sinfo));
+ nmtst_main_loop_run(gl.loop, 50);
+ } else {
+ g_clear_object(&client);
+ }
g_assert_cmpint(call_count, ==, 1);
@@ -1621,7 +1626,12 @@ main(int argc, char **argv)
g_test_add_func("/libnm/client-nm-running", test_client_nm_running);
g_test_add_func("/libnm/active-connections", test_active_connections);
g_test_add_func("/libnm/activate-virtual/without-teardown", test_activate_virtual);
- g_test_add_func("/libnm/activate-virtual/with-teardown", test_activate_virtual_teardown);
+ g_test_add_data_func("/libnm/activate-virtual/with-teardown/service",
+ GINT_TO_POINTER(true),
+ test_activate_virtual_teardown);
+ g_test_add_data_func("/libnm/activate-virtual/with-teardown/client",
+ GINT_TO_POINTER(false),
+ test_activate_virtual_teardown);
g_test_add_func("/libnm/device-connection-compatibility", test_device_connection_compatibility);
g_test_add_func("/libnm/connection/invalid", test_connection_invalid);
g_test_add_func("/libnm/test_client_wait_shutdown", test_client_wait_shutdown);