From 6bf206eb810f3f72115e2194f615fce88fb3b0f2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 3 Nov 2019 22:26:04 +0100 Subject: [PATCH] libnm/tests: drop test_activate_failed() test With this test the stub service simulates a failure to add-and-activate the connection. However the implementation of the stub service was not simulating the real behavior of NetworkManager service. libnm will add the possibility to assert against invalid server behavior by setting LIBNM_CLIENT_DEBUG=error. With that change, libnm will complain that the stub service behaves invalid, and rightly so. Instead of fixing the test, just drop it. --- libnm/tests/test-nm-client.c | 43 ---------------------------- tools/test-networkmanager-service.py | 8 ------ 2 files changed, 51 deletions(-) diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c index e92e1cd1e3..c6b26a21ab 100644 --- a/libnm/tests/test-nm-client.c +++ b/libnm/tests/test-nm-client.c @@ -886,48 +886,6 @@ test_activate_virtual (void) } } -static void -activate_failed_cb (GObject *object, - GAsyncResult *result, - gpointer user_data) -{ - NMClient *client = NM_CLIENT (object); - NMActiveConnection *ac; - GError *error = NULL; - - ac = nm_client_add_and_activate_connection_finish (client, result, &error); - g_assert (ac == NULL); - g_assert_error (error, NM_CLIENT_ERROR, NM_CLIENT_ERROR_OBJECT_CREATION_FAILED); - g_clear_error (&error); - - g_main_loop_quit (gl.loop); -} - -static void -test_activate_failed (void) -{ - nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL; - gs_unref_object NMClient *client = NULL; - NMDevice *device; - gs_unref_object NMConnection *conn = NULL; - - sinfo = nmtstc_service_init (); - if (!nmtstc_service_available (sinfo)) - return; - - client = nmtstc_client_new (TRUE); - - device = nmtstc_service_add_device (sinfo, client, "AddWiredDevice", "eth0"); - - /* Note that test-networkmanager-service.py checks for this exact name */ - conn = nmtst_create_minimal_connection ("object-creation-failed-test", NULL, - NM_SETTING_WIRED_SETTING_NAME, NULL); - - nm_client_add_and_activate_connection_async (client, conn, device, NULL, - NULL, activate_failed_cb, NULL); - g_main_loop_run (gl.loop); -} - static void test_device_connection_compatibility (void) { @@ -1354,7 +1312,6 @@ 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", test_activate_virtual); - g_test_add_func ("/libnm/activate-failed", test_activate_failed); g_test_add_func ("/libnm/device-connection-compatibility", test_device_connection_compatibility); g_test_add_func ("/libnm/connection/invalid", test_connection_invalid); diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py index e91b45233e..1a8e2e6af5 100755 --- a/tools/test-networkmanager-service.py +++ b/tools/test-networkmanager-service.py @@ -1306,14 +1306,6 @@ class NetworkManager(ExportedObj): ac = ActiveConnection(device, con_inst, None) self.active_connection_add(ac) - - if NmUtil.con_hash_get_id(con_hash) == 'object-creation-failed-test': - # FIXME: this is not the right test, to delete the active-connection - # before returning it. It's the wrong order of what NetworkManager - # would do. - self.active_connection_remove(ac) - return ExportedObj.to_path(ac) - return ExportedObj.to_path(ac) def active_connection_add(self, ac):