Skip to content

Commit ebdaa0c

Browse files
committed
Fix use of salt_systemd_setup fixture
Fixes use of salt_systemd_setup fixture - we need to call it for each test function otherwise state will persist across tests. Made it a function scoped fixture and removed the attempts to call it in the functions, which wouldn't work.
1 parent a76598b commit ebdaa0c

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

tests/pytests/pkg/upgrade/test_systemd_permissions.py

+1-21
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
]
88

99

10-
@pytest.fixture
10+
@pytest.fixture(scope="function")
1111
def salt_systemd_setup(
1212
salt_call_cli,
1313
install_salt,
@@ -39,10 +39,6 @@ def test_salt_systemd_disabled_preservation(
3939
if not install_salt.upgrade:
4040
pytest.skip("Not testing an upgrade, do not run")
4141

42-
# setup systemd to enabled and active for Salt packages
43-
# pylint: disable=pointless-statement
44-
salt_systemd_setup
45-
4642
# ensure known state, disabled
4743
test_list = ["salt-api", "salt-minion", "salt-master"]
4844
for test_item in test_list:
@@ -74,10 +70,6 @@ def test_salt_systemd_enabled_preservation(
7470
if not install_salt.upgrade:
7571
pytest.skip("Not testing an upgrade, do not run")
7672

77-
# setup systemd to enabled and active for Salt packages
78-
# pylint: disable=pointless-statement
79-
salt_systemd_setup
80-
8173
# Upgrade Salt (inc. minion, master, etc.) from previous version and test
8274
# pylint: disable=pointless-statement
8375
install_salt.install(upgrade=True)
@@ -102,10 +94,6 @@ def test_salt_systemd_inactive_preservation(
10294
if not install_salt.upgrade:
10395
pytest.skip("Not testing an upgrade, do not run")
10496

105-
# setup systemd to enabled and active for Salt packages
106-
# pylint: disable=pointless-statement
107-
salt_systemd_setup
108-
10997
# ensure known state, disabled
11098
test_list = ["salt-api", "salt-minion", "salt-master"]
11199
for test_item in test_list:
@@ -137,10 +125,6 @@ def test_salt_systemd_active_preservation(
137125
if not install_salt.upgrade:
138126
pytest.skip("Not testing an upgrade, do not run")
139127

140-
# setup systemd to enabled and active for Salt packages
141-
# pylint: disable=pointless-statement
142-
salt_systemd_setup
143-
144128
# Upgrade Salt (inc. minion, master, etc.) from previous version and test
145129
# pylint: disable=pointless-statement
146130
install_salt.install(upgrade=True)
@@ -163,10 +147,6 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set
163147
if not install_salt.upgrade:
164148
pytest.skip("Not testing an upgrade, do not run")
165149

166-
# setup systemd to enabled and active for Salt packages
167-
# pylint: disable=pointless-statement
168-
salt_systemd_setup
169-
170150
# test ownership for Minion, Master and Api
171151
test_list = ["salt-api", "salt-minion", "salt-master"]
172152
for test_item in test_list:

0 commit comments

Comments
 (0)