ifcfg-rh: add testcase for empty Team port config

Add testcase for 3e70fb20d4.
This commit is contained in:
Dan Williams
2014-02-14 10:04:33 -06:00
parent a0e734764f
commit aeefde7513
3 changed files with 34 additions and 1 deletions

View File

@@ -112,7 +112,8 @@ EXTRA_DIST = \
ifcfg-test-fcoe-fabric \ ifcfg-test-fcoe-fabric \
ifcfg-test-fcoe-vn2vn \ ifcfg-test-fcoe-vn2vn \
ifcfg-test-team-master \ ifcfg-test-team-master \
ifcfg-test-team-port ifcfg-test-team-port \
ifcfg-test-team-port-empty-config
check-local: check-local:
@for f in $(EXTRA_DIST); do \ @for f in $(EXTRA_DIST); do \

View File

@@ -0,0 +1,4 @@
TYPE=Ethernet
DEVICE=p4p1
TEAM_MASTER=team0
DEVICETYPE=TeamPort

View File

@@ -13475,6 +13475,33 @@ test_write_team_port (void)
g_object_unref (reread); g_object_unref (reread);
} }
static void
test_read_team_port_empty_config (void)
{
NMConnection *connection;
NMSettingConnection *s_con;
gboolean success;
GError *error = NULL;
connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-team-port-empty-config",
NULL, TYPE_ETHERNET, NULL, NULL, NULL, NULL, NULL, &error, NULL);
g_assert_no_error (error);
g_assert (connection);
success = nm_connection_verify (connection, &error);
g_assert_no_error (error);
g_assert (success);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_WIRED_SETTING_NAME);
g_assert_cmpstr (nm_setting_connection_get_master (s_con), ==, "team0");
/* Empty TEAM_PORT_CONFIG means no team-port setting */
g_assert (nm_connection_get_setting_team_port (connection) == NULL);
g_object_unref (connection);
}
/* Old algorithm for "remove escaped characters in place". /* Old algorithm for "remove escaped characters in place".
* *
@@ -13804,6 +13831,7 @@ int main (int argc, char **argv)
g_test_add_func (TPATH "team/write-master", test_write_team_master); g_test_add_func (TPATH "team/write-master", test_write_team_master);
g_test_add_func (TPATH "team/read-port", test_read_team_port); g_test_add_func (TPATH "team/read-port", test_read_team_port);
g_test_add_func (TPATH "team/write-port", test_write_team_port); g_test_add_func (TPATH "team/write-port", test_write_team_port);
g_test_add_func (TPATH "team/read-port-empty-config", test_read_team_port_empty_config);
/* Stuff we expect to fail for now */ /* Stuff we expect to fail for now */
test_write_wired_pppoe (); test_write_wired_pppoe ();