From: Paul Cuzner Date: Thu, 14 Jan 2021 20:56:15 +0000 (+1300) Subject: cephadm: unit test updates for new subnet function X-Git-Tag: v17.1.0~3083^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3f352c8af4ddedd6ae7fc69045e42d07dad261c2;p=ceph.git cephadm: unit test updates for new subnet function Adds tests to validate the check_subnet function will work as expected with various inputs Signed-off-by: Paul Cuzner --- diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py index dae49a090374..f0c496092d18 100644 --- a/src/cephadm/tests/test_cephadm.py +++ b/src/cephadm/tests/test_cephadm.py @@ -652,6 +652,22 @@ iMN28C2bKGao5UHvdER1rGy7 with pytest.raises(HTTPError, match=r"HTTP Error 501: .*") as e: urlopen(req) + def test_ipv4_subnet(self): + rc, v, msg = cd.check_subnet('192.168.1.0/24') + assert rc == 0 and v == 4 + + def test_ipv6_subnet(self): + rc, v, msg = cd.check_subnet('fe80::/64') + assert rc == 0 and v == 6 + + def test_subnet_mask_missing(self): + rc, v, msg = cd.check_subnet('192.168.1.58') + assert rc == 1 and msg + + def test_subnet_mask_junk(self): + rc, v, msg = cd.check_subnet('wah') + assert rc == 1 and msg + class TestMaintenance: systemd_target = "ceph.00000000-0000-0000-0000-000000c0ffee.target"