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.
This commit is contained in:
Fernando Fernandez Mancera 2023-06-26 17:32:50 +02:00
parent a705975a9e
commit b0b31548d9

View file

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