Browse Source

Remove env variable from RBAC tests

Since the env option and fixtures depending on it were not in use
by any RBAC test anymore, they were removed from code.

Fixtures removed:
- env

Story: 2009156
Task: 43128

Signed-off-by: Rafael Fayan <RafaelShibana.Fayan@windriver.com>
Change-Id: I15c3758263c3ec00385e063cad03f82f92fbd21d
changes/06/806206/8
Rafael Fayan 5 months ago
committed by Lucas Wizer da Silva
parent
commit
778d67dc6b
  1. 29
      enhanced-policies/tests/conftest.py
  2. 4
      enhanced-policies/tests/fv_rbac.py
  3. 4
      enhanced-policies/tests/test_neutron/test_rbac_neutron.py
  4. 2
      enhanced-policies/tests/test_nova/test_rbac_nova.py

29
enhanced-policies/tests/conftest.py

@ -13,20 +13,6 @@ from tests.fv_rbac import OpenStackNetworkingSetup
from tests.fv_rbac import OpenStackTestingSetup
def pytest_addoption(parser):
parser.addoption(
"--env",
action="store",
default="stx",
help="Environment to run tests against (stx or wro). Default: stx"
)
@fixture(scope="session")
def env(request):
return request.config.getoption("--env")
@fixture(scope='session')
def rbac_setup(request):
@ -90,9 +76,9 @@ def rbac_setup(request):
@fixture(scope='session')
def network_admin_setup(request, rbac_setup, env):
def network_admin_setup(request, rbac_setup):
cfg = OpenStackNetworkingSetup(env)
cfg = OpenStackNetworkingSetup()
# Create segment ranges based on projects
cfg._create_network_segment_range(
@ -102,7 +88,6 @@ def network_admin_setup(request, rbac_setup, env):
physical_network="group0-data0",
minimum=10, maximum=10
)
cfg._create_network_segment_range(
"group0-data0-r0",
project_name="project1",
@ -111,7 +96,6 @@ def network_admin_setup(request, rbac_setup, env):
physical_network="group0-data0",
minimum=400, maximum=499
)
cfg._create_network_segment_range(
"group0-data0b-r0",
shared=True,
@ -119,7 +103,6 @@ def network_admin_setup(request, rbac_setup, env):
physical_network="group0-data0",
minimum=500, maximum=599
)
cfg._create_network_segment_range(
"group0-data1-r0",
project="project2",
@ -129,19 +112,11 @@ def network_admin_setup(request, rbac_setup, env):
minimum=600, maximum=699
)
if env == "wro":
cfg._create_qos("admin-qos", weight=16,
description="External Network Policy")
def network_admin_teardown():
cfg._delete_network_segment_range("group0-data1-r0")
cfg._delete_network_segment_range("group0-data0b-r0")
cfg._delete_network_segment_range("group0-data0-r0")
cfg._delete_network_segment_range("group0-ext-r0")
if env == "wro":
cfg._delete_qos("admin-qos")
request.addfinalizer(network_admin_teardown)
return cfg

4
enhanced-policies/tests/fv_rbac.py

@ -147,9 +147,8 @@ class OpenStackTestingSetup:
class OpenStackNetworkingSetup(OpenStackTestingSetup):
def __init__(self, env):
def __init__(self):
super(OpenStackNetworkingSetup, self).__init__()
self.env = env
def _create_network_segment_range(self, name, project_name=None, **kwargs):
sr = self.os_sdk_admin_conn.network.find_network_segment_range(name)
@ -158,7 +157,6 @@ class OpenStackNetworkingSetup(OpenStackTestingSetup):
if project_name:
project_id = self.os_sdk_admin_conn.get_project(
project_name).id
if project_id is None:
return self.os_sdk_admin_conn.network. \
create_network_segment_range(name=name, **kwargs)

4
enhanced-policies/tests/test_neutron/test_rbac_neutron.py

@ -18,17 +18,13 @@ from tests.test_neutron.rbac_neutron import OpenStackNetworkingTesting
def networking_setup(request, network_admin_setup):
cfg = network_admin_setup
request.cls.os_sdk_admin_conn = cfg.os_sdk_admin_conn
request.cls.users = cfg.users
request.cls.user02 = cfg.user02
request.cls.user11 = cfg.user11
request.cls.user12 = cfg.user12
request.cls.user13 = cfg.user13
request.cls.env = cfg.env
class TestNetworking(OpenStackNetworkingTesting):
def test_uc_network_1(self, tc_teardown):

2
enhanced-policies/tests/test_nova/test_rbac_nova.py

@ -18,6 +18,7 @@ from tests.test_nova.rbac_nova import OpenStackComputeTesting
@pytest.fixture(scope='class', autouse=True)
def networking_setup(request, network_admin_setup):
cfg = network_admin_setup
request.cls.os_sdk_admin_conn = cfg.os_sdk_admin_conn
request.cls.users = cfg.users
@ -28,7 +29,6 @@ def networking_setup(request, network_admin_setup):
request.cls.user21 = cfg.user21
request.cls.user22 = cfg.user22
request.cls.user23 = cfg.user23
request.cls.env = cfg.env
class TestVM(OpenStackComputeTesting):

Loading…
Cancel
Save