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.
This commit is contained in:
Thomas Haller 2019-11-03 22:26:04 +01:00
parent feea4222ef
commit 6bf206eb81
2 changed files with 0 additions and 51 deletions

View file

@ -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);

View file

@ -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):