mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 00:31:11 +00:00
ifcfg-rh/tests: add unit test for persisting NMSettingEthtool
In particular the case with an all-default NMSettingEthtool is currently broken. The test is checking the wrong behavior, which will be fixed next.
This commit is contained in:
parent
3fdedde16f
commit
ef0f9b871b
|
@ -3431,8 +3431,8 @@ EXTRA_DIST += \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy.cexpected \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-static-routes-legacy.cexpected \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-tc \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-tc \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-tc-write.cexpected \
|
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-tc-write-empty.cexpected \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-tc-write-empty.cexpected \
|
||||||
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-tc-write.cexpected \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1 \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1 \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2 \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2 \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-invalid \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-invalid \
|
||||||
|
@ -3537,6 +3537,11 @@ EXTRA_DIST += \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-write-unknown-3.expected \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-write-unknown-3.expected \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-write-unknown-4 \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-write-unknown-4 \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-write-unknown-4.expected \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-write-unknown-4.expected \
|
||||||
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-1.cexpected \
|
||||||
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-2.cexpected \
|
||||||
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-3.cexpected \
|
||||||
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-4.cexpected \
|
||||||
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-5.cexpected \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_write_wired_auto_negotiate_on.cexpected \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_write_wired_auto_negotiate_on.cexpected \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-dynamic-wep-leap \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-dynamic-wep-leap \
|
||||||
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-leap \
|
src/core/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-leap \
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
TYPE=Ethernet
|
||||||
|
PROXY_METHOD=none
|
||||||
|
BROWSER_ONLY=no
|
||||||
|
BOOTPROTO=dhcp
|
||||||
|
DEFROUTE=yes
|
||||||
|
IPV4_FAILURE_FATAL=no
|
||||||
|
IPV6INIT=yes
|
||||||
|
IPV6_AUTOCONF=yes
|
||||||
|
IPV6_DEFROUTE=yes
|
||||||
|
IPV6_FAILURE_FATAL=no
|
||||||
|
IPV6_ADDR_GEN_MODE=stable-privacy
|
||||||
|
NAME=test_roundtrip_ethtool
|
||||||
|
UUID=${UUID}
|
||||||
|
ONBOOT=yes
|
|
@ -0,0 +1,14 @@
|
||||||
|
TYPE=Ethernet
|
||||||
|
PROXY_METHOD=none
|
||||||
|
BROWSER_ONLY=no
|
||||||
|
BOOTPROTO=dhcp
|
||||||
|
DEFROUTE=yes
|
||||||
|
IPV4_FAILURE_FATAL=no
|
||||||
|
IPV6INIT=yes
|
||||||
|
IPV6_AUTOCONF=yes
|
||||||
|
IPV6_DEFROUTE=yes
|
||||||
|
IPV6_FAILURE_FATAL=no
|
||||||
|
IPV6_ADDR_GEN_MODE=stable-privacy
|
||||||
|
NAME=test_roundtrip_ethtool
|
||||||
|
UUID=${UUID}
|
||||||
|
ONBOOT=yes
|
|
@ -0,0 +1,15 @@
|
||||||
|
TYPE=Ethernet
|
||||||
|
PROXY_METHOD=none
|
||||||
|
BROWSER_ONLY=no
|
||||||
|
ETHTOOL_OPTS="autoneg on"
|
||||||
|
BOOTPROTO=dhcp
|
||||||
|
DEFROUTE=yes
|
||||||
|
IPV4_FAILURE_FATAL=no
|
||||||
|
IPV6INIT=yes
|
||||||
|
IPV6_AUTOCONF=yes
|
||||||
|
IPV6_DEFROUTE=yes
|
||||||
|
IPV6_FAILURE_FATAL=no
|
||||||
|
IPV6_ADDR_GEN_MODE=stable-privacy
|
||||||
|
NAME=test_roundtrip_ethtool
|
||||||
|
UUID=${UUID}
|
||||||
|
ONBOOT=yes
|
|
@ -0,0 +1,15 @@
|
||||||
|
TYPE=Ethernet
|
||||||
|
PROXY_METHOD=none
|
||||||
|
BROWSER_ONLY=no
|
||||||
|
ETHTOOL_OPTS="-K net0 rx on"
|
||||||
|
BOOTPROTO=dhcp
|
||||||
|
DEFROUTE=yes
|
||||||
|
IPV4_FAILURE_FATAL=no
|
||||||
|
IPV6INIT=yes
|
||||||
|
IPV6_AUTOCONF=yes
|
||||||
|
IPV6_DEFROUTE=yes
|
||||||
|
IPV6_FAILURE_FATAL=no
|
||||||
|
IPV6_ADDR_GEN_MODE=stable-privacy
|
||||||
|
NAME=test_roundtrip_ethtool
|
||||||
|
UUID=${UUID}
|
||||||
|
ONBOOT=yes
|
|
@ -0,0 +1,15 @@
|
||||||
|
TYPE=Ethernet
|
||||||
|
PROXY_METHOD=none
|
||||||
|
BROWSER_ONLY=no
|
||||||
|
ETHTOOL_OPTS="autoneg on ; -K net0 rx on"
|
||||||
|
BOOTPROTO=dhcp
|
||||||
|
DEFROUTE=yes
|
||||||
|
IPV4_FAILURE_FATAL=no
|
||||||
|
IPV6INIT=yes
|
||||||
|
IPV6_AUTOCONF=yes
|
||||||
|
IPV6_DEFROUTE=yes
|
||||||
|
IPV6_FAILURE_FATAL=no
|
||||||
|
IPV6_ADDR_GEN_MODE=stable-privacy
|
||||||
|
NAME=test_roundtrip_ethtool
|
||||||
|
UUID=${UUID}
|
||||||
|
ONBOOT=yes
|
|
@ -3948,6 +3948,75 @@ test_read_wired_unknown_ethtool_opt(void)
|
||||||
g_assert_cmpstr(nm_setting_wired_get_wake_on_lan_password(s_wired), ==, "00:11:22:33:44:55");
|
g_assert_cmpstr(nm_setting_wired_get_wake_on_lan_password(s_wired), ==, "00:11:22:33:44:55");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_roundtrip_ethtool(void)
|
||||||
|
{
|
||||||
|
gs_unref_object NMConnection *connection = NULL;
|
||||||
|
NMSetting * s_ethtool;
|
||||||
|
NMSetting * s_wired;
|
||||||
|
|
||||||
|
connection = nmtst_create_minimal_connection("test_roundtrip_ethtool",
|
||||||
|
NULL,
|
||||||
|
NM_SETTING_WIRED_SETTING_NAME,
|
||||||
|
NULL);
|
||||||
|
_writer_new_connec_exp(connection,
|
||||||
|
TEST_SCRATCH_DIR,
|
||||||
|
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-1.cexpected",
|
||||||
|
NULL);
|
||||||
|
g_clear_object(&connection);
|
||||||
|
|
||||||
|
connection = nmtst_create_minimal_connection("test_roundtrip_ethtool",
|
||||||
|
NULL,
|
||||||
|
NM_SETTING_WIRED_SETTING_NAME,
|
||||||
|
NULL);
|
||||||
|
/* TODO: add empty NMSettingEthtool, which currently would break the test. */
|
||||||
|
_writer_new_connec_exp(connection,
|
||||||
|
TEST_SCRATCH_DIR,
|
||||||
|
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-2.cexpected",
|
||||||
|
NULL);
|
||||||
|
g_clear_object(&connection);
|
||||||
|
|
||||||
|
connection = nmtst_create_minimal_connection("test_roundtrip_ethtool",
|
||||||
|
NULL,
|
||||||
|
NM_SETTING_WIRED_SETTING_NAME,
|
||||||
|
NULL);
|
||||||
|
s_wired = nm_connection_get_setting(connection, NM_TYPE_SETTING_WIRED);
|
||||||
|
g_object_set(s_wired, NM_SETTING_WIRED_AUTO_NEGOTIATE, TRUE, NULL);
|
||||||
|
_writer_new_connec_exp(connection,
|
||||||
|
TEST_SCRATCH_DIR,
|
||||||
|
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-3.cexpected",
|
||||||
|
NULL);
|
||||||
|
g_clear_object(&connection);
|
||||||
|
|
||||||
|
connection = nmtst_create_minimal_connection("test_roundtrip_ethtool",
|
||||||
|
NULL,
|
||||||
|
NM_SETTING_WIRED_SETTING_NAME,
|
||||||
|
NULL);
|
||||||
|
s_ethtool = nm_setting_ethtool_new();
|
||||||
|
nm_connection_add_setting(connection, s_ethtool);
|
||||||
|
nm_setting_option_set_boolean(s_ethtool, NM_ETHTOOL_OPTNAME_FEATURE_RX, TRUE);
|
||||||
|
_writer_new_connec_exp(connection,
|
||||||
|
TEST_SCRATCH_DIR,
|
||||||
|
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-4.cexpected",
|
||||||
|
NULL);
|
||||||
|
g_clear_object(&connection);
|
||||||
|
|
||||||
|
connection = nmtst_create_minimal_connection("test_roundtrip_ethtool",
|
||||||
|
NULL,
|
||||||
|
NM_SETTING_WIRED_SETTING_NAME,
|
||||||
|
NULL);
|
||||||
|
s_wired = nm_connection_get_setting(connection, NM_TYPE_SETTING_WIRED);
|
||||||
|
g_object_set(s_wired, NM_SETTING_WIRED_AUTO_NEGOTIATE, TRUE, NULL);
|
||||||
|
s_ethtool = nm_setting_ethtool_new();
|
||||||
|
nm_connection_add_setting(connection, s_ethtool);
|
||||||
|
nm_setting_option_set_boolean(s_ethtool, NM_ETHTOOL_OPTNAME_FEATURE_RX, TRUE);
|
||||||
|
_writer_new_connec_exp(connection,
|
||||||
|
TEST_SCRATCH_DIR,
|
||||||
|
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-5.cexpected",
|
||||||
|
NULL);
|
||||||
|
g_clear_object(&connection);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_read_wifi_hidden(void)
|
test_read_wifi_hidden(void)
|
||||||
{
|
{
|
||||||
|
@ -11648,6 +11717,8 @@ main(int argc, char **argv)
|
||||||
g_test_add_func(TPATH "802-1x/password_raw", test_read_write_802_1x_password_raw);
|
g_test_add_func(TPATH "802-1x/password_raw", test_read_write_802_1x_password_raw);
|
||||||
g_test_add_func(TPATH "802-1x/tls-p12-no-client-cert", test_read_802_1x_tls_p12_no_client_cert);
|
g_test_add_func(TPATH "802-1x/tls-p12-no-client-cert", test_read_802_1x_tls_p12_no_client_cert);
|
||||||
|
|
||||||
|
g_test_add_func(TPATH "wired/roundtrip/ethtool", test_roundtrip_ethtool);
|
||||||
|
|
||||||
g_test_add_data_func(TPATH "wired/read/aliases/good/0",
|
g_test_add_data_func(TPATH "wired/read/aliases/good/0",
|
||||||
GINT_TO_POINTER(0),
|
GINT_TO_POINTER(0),
|
||||||
test_read_wired_aliases_good);
|
test_read_wired_aliases_good);
|
||||||
|
|
Loading…
Reference in a new issue