Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- test/tasst/exesite.py | 11 ++++++++++- test/tasst/meta/veth.py | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test/tasst/exesite.py b/test/tasst/exesite.py index 246f9b3f..63872c34 100644 --- a/test/tasst/exesite.py +++ b/test/tasst/exesite.py @@ -124,6 +124,11 @@ class Site(contextlib.AbstractContextManager): for ai in self.addrinfos(ifname, **criteria) if 'tentative' not in ai] + def mtu(self, ifname): + self.require_cmds('ip') + (info,) = json.loads(self.output(f'ip -j link show {ifname}')) + return info['mtu'] + def test_site(sitefn): def test_true(s): @@ -184,10 +189,14 @@ def test_site(sitefn): with s as site: assert_eq_unordered(site.addrs('lo'), expected) + def test_lo_mtu(s): + with s as site: + assert_eq(site.mtu('lo'), 65536) + return test_output(test_true, test_false, test_echo, test_timeout, test_bg_true, test_bg_false, test_bg_echo, test_bg_timeout, test_bg_context_timeout, - test_has_lo, test_lo_addrs)(sitefn) + test_has_lo, test_lo_addrs, test_lo_mtu)(sitefn) def test_isolated_site(sitefn): diff --git a/test/tasst/meta/veth.py b/test/tasst/meta/veth.py index 9cef6271..053bd9c8 100644 --- a/test/tasst/meta/veth.py +++ b/test/tasst/meta/veth.py @@ -13,7 +13,7 @@ meta/veth.py - Test various veth configurations import contextlib -from avocado_classless.test import assert_eq_unordered, test +from avocado_classless.test import assert_eq, assert_eq_unordered, test from tasst.nstool import unshare_site @@ -31,3 +31,10 @@ def test_ifs(): with unconfigured_veth() as (ns1, ns2): assert_eq_unordered(ns1.ifs(), ['lo', 'veth1']) assert_eq_unordered(ns2.ifs(), ['lo', 'veth2']) + + +@test +def test_mtu(): + with unconfigured_veth() as (ns1, ns2): + assert_eq(ns1.mtu('veth1'), 1500) + assert_eq(ns2.mtu('veth2'), 1500) -- 2.41.0