summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-03-27 17:28:47 +0100
committerThomas Haller <thaller@redhat.com>2015-03-29 14:56:21 +0200
commitd53de606b733ba97025a13316b8afde5bc742330 (patch)
treebbc76b6e5677a138cd2be11c4e7308dc9cc4787c
parentc4929fbea9c74fe977edaa476d52eea01c90f1ac (diff)
downloadNetworkManager-th/route-manager-bgo740064-v1.tar.gz
route-manager/test: add variations to test codeth/route-manager-bgo740064-v1
-rw-r--r--src/tests/test-route-manager.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tests/test-route-manager.c b/src/tests/test-route-manager.c
index b0606e8156..8332a8624c 100644
--- a/src/tests/test-route-manager.c
+++ b/src/tests/test-route-manager.c
@@ -36,7 +36,7 @@ typedef struct {
} test_fixture;
static void
-setup_dev0_ip4 (int ifindex)
+setup_dev0_ip4 (int ifindex, guint mss_of_first_route, guint32 metric_of_second_route)
{
GArray *routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Route));
NMPlatformIP4Route route;
@@ -49,13 +49,15 @@ setup_dev0_ip4 (int ifindex)
route.plen = 24;
route.gateway = INADDR_ANY;
route.metric = 20;
+ route.mss = mss_of_first_route;
g_array_append_val (routes, route);
route.source = NM_IP_CONFIG_SOURCE_USER;
inet_pton (AF_INET, "7.0.0.0", &route.network);
route.plen = 8;
inet_pton (AF_INET, "6.6.6.1", &route.gateway);
- route.metric = 21;
+ route.metric = metric_of_second_route;
+ route.mss = 0;
g_array_append_val (routes, route);
nm_route_manager_ip4_route_sync (nm_route_manager_get (), ifindex, routes);
@@ -162,7 +164,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.ifindex = fixture->ifindex0,
.gateway = INADDR_ANY,
.metric = 20,
- .mss = 0,
+ .mss = 1000,
},
{
.source = NM_IP_CONFIG_SOURCE_USER,
@@ -170,7 +172,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
.plen = 8,
.ifindex = fixture->ifindex0,
.gateway = nmtst_inet4_from_string ("6.6.6.1"),
- .metric = 21,
+ .metric = 21021,
.mss = 0,
},
{
@@ -235,7 +237,7 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
},
};
- setup_dev0_ip4 (fixture->ifindex0);
+ setup_dev0_ip4 (fixture->ifindex0, 1000, 21021);
g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING, "*error adding 8.0.0.0/8 via 6.6.6.2 dev nm-test-device1 *");
setup_dev1_ip4 (fixture->ifindex1);
g_test_assert_expected_messages ();
@@ -252,11 +254,13 @@ test_ip4 (test_fixture *fixture, gconstpointer user_data)
setup_dev1_ip4 (fixture->ifindex1);
g_test_assert_expected_messages ();
- setup_dev0_ip4 (fixture->ifindex0);
+ setup_dev0_ip4 (fixture->ifindex0, 0, 21);
/* Ensure nothing changed. */
routes = ip4_routes (fixture);
g_assert_cmpint (routes->len, ==, G_N_ELEMENTS (state1));
+ state1[0].mss = 0;
+ state1[1].metric = 21;
nmtst_platform_ip4_routes_equal ((NMPlatformIP4Route *) routes->data, state1, routes->len, TRUE);
g_array_free (routes, TRUE);