From b0b31548d9e517a6ea070eb4e7cfdd656661bd66 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Mon, 26 Jun 2023 17:32:50 +0200 Subject: [PATCH] tests: fix linux bridge port option test When configuring the bridge port options the code was checking on port link type instead of controller link type. In addition, the test is now being skipped for nm-fake-platform. --- src/core/platform/tests/test-link.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index 41a3afb3c3..153fb62997 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -303,6 +303,15 @@ test_slave(int master, int type, SignalData *master_changed) g_assert(link); g_assert_cmpint(link->port_data.bond.queue_id, ==, 5); g_assert(link->port_data.bond.prio_has || link->port_data.bond.prio == 0); + } else if (link_type == NM_LINK_TYPE_BRIDGE) { + /* Skip this part for nm-fake-platform */ + if (nmtstp_is_root_test() && nmtstp_is_sysfs_writable()) { + g_assert( + nm_platform_sysctl_slave_set_option(NM_PLATFORM_GET, ifindex, "priority", "614")); + value = nm_platform_sysctl_slave_get_option(NM_PLATFORM_GET, ifindex, "priority"); + g_assert_cmpstr(value, ==, "614"); + g_free(value); + } } test_link_changed_signal_arg1 = FALSE; @@ -387,21 +396,6 @@ test_slave(int master, int type, SignalData *master_changed) accept_signals(link_changed, 0, 2); accept_signals(master_changed, 0, 2); - /* Set slave option */ - switch (type) { - case NM_LINK_TYPE_BRIDGE: - if (nmtstp_is_sysfs_writable()) { - g_assert( - nm_platform_sysctl_slave_set_option(NM_PLATFORM_GET, ifindex, "priority", "614")); - value = nm_platform_sysctl_slave_get_option(NM_PLATFORM_GET, ifindex, "priority"); - g_assert_cmpstr(value, ==, "614"); - g_free(value); - } - break; - default: - break; - } - /* Release */ ensure_no_signal(link_added); ensure_no_signal(link_changed);