From 4fac961028c0e00108b875b3464d5eab7cbfc328 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 7 Dec 2018 12:54:05 +0100 Subject: [PATCH] Refactor test_mtu test case after base scenario test case changed. Change-Id: I021802888312befc89d7e46f1b191292ae8ed7b3 --- tobiko/tests/scenario/test_mtu.py | 39 +++++++++++-------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/tobiko/tests/scenario/test_mtu.py b/tobiko/tests/scenario/test_mtu.py index eac570f68..f7c1bf722 100644 --- a/tobiko/tests/scenario/test_mtu.py +++ b/tobiko/tests/scenario/test_mtu.py @@ -26,39 +26,28 @@ from testtools import skip class MTUTest(base.ScenarioTestsBase): """Tests MTU.""" - def setUp(self): - super(MTUTest, self).setUp() - self.stack = self._get_stack() - self.fip_max_mtu = self.stackManager.get_output( - self.stack, "fip_max_mtu") - self.fip_min_mtu = self.stackManager.get_output( - self.stack, "fip_min_mtu") - self.net_max_mtu = self.networkManager.client.show_network( - self.stackManager.get_output(self.stack, "network_max_mtu")) - self.net_min_mtu = self.networkManager.client.show_network( - self.stackManager.get_output(self.stack, "network_min_mtu")) + @classmethod + def setUpClass(cls): + super(MTUTest, cls).setUpClass() - def test_pre_mtu(self): - """Validates MTU before upgrade.""" + cls.fip_max_mtu = cls.stacks.get_output(cls.stack, "fip_max_mtu") + cls.net_max_mtu = cls.networks.client.show_network( + cls.stackManager.get_output(cls.stack, "network_max_mtu")) - # Ping without fragmentation and without changing MTU should succeed + cls.fip_min_mtu = cls.stacks.get_output(cls.stack, "fip_min_mtu") + cls.net_min_mtu = cls.networkManager.client.show_network( + cls.stackManager.get_output(cls.stack, "network_min_mtu")) + + def test_ping_max_mtu(self): assert_ping(self.fip_max_mtu) - assert_ping(self.fip_min_mtu) + def test_ping_min_mtu(self): + # Ping without fragmentation and without changing MTU should succeed + assert_ping(self.fip_min_mtu) assert_ping(self.fip_min_mtu, should_fail=True, mtu=self.net_min_mtu['network']['mtu'] + 100, fragmentation=False) - def test_post_mtu(self): - """Validates MTU post upgrade.""" - - # Assert ping without fragmentation still works - assert_ping(self.fip_max_mtu) - - assert_ping(self.fip_max_mtu, should_fail=True, - mtu=self.net_max_mtu['network']['mtu'] + 100, - fragmentation=False) - @utils.requires_ext(extension="net-mtu-writable", service="network") def test_post_writeable_mtu(self): """Validates writeable MTU post upgrade."""