| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
from unittest import mock |
| 16 |
|
| 17 |
from oslo_config import cfg |
| 18 |
from oslo_upgradecheck.upgradecheck import Code |
| 19 |
|
| 20 |
from neutron_fwaas.cmd.upgrade_checks import checks |
| 21 |
from neutron_fwaas.tests import base |
| 22 |
|
| 23 |
|
| 24 |
class TestChecks(base.BaseTestCase): |
| 25 |
|
| 26 |
def setUp(self): |
| 27 |
super().setUp() |
| 28 |
self.checks = checks.Checks() |
| 29 |
|
| 30 |
def test_get_checks_list(self): |
| 31 |
self.assertIsInstance(self.checks.get_checks(), list) |
| 32 |
|
| 33 |
def test_fwaas_v1_check_sucess(self): |
| 34 |
cfg.CONF.set_override('service_plugins', ['l3', 'qos']) |
| 35 |
check_result = checks.Checks.fwaas_v1_check(mock.Mock()) |
| 36 |
self.assertEqual(Code.SUCCESS, check_result.code) |
| 37 |
|
| 38 |
def test_fwaas_v1_check_warning(self): |
| 39 |
plugins_to_check = [ |
| 40 |
['l3', 'firewall', 'qos'], |
| 41 |
['l3', |
| 42 |
'neutron_fwaas.services.firewall.fwaas_plugin:FirewallPlugin', |
| 43 |
'qos']] |
| 44 |
for plugins in plugins_to_check: |
| 45 |
cfg.CONF.set_override('service_plugins', plugins) |
| 46 |
check_result = checks.Checks.fwaas_v1_check(mock.Mock()) |
| 47 |
self.assertEqual(Code.FAILURE, check_result.code) |