Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions misc/blivet-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- stratisd
- stratis-cli
- libblockdev-tools
- udisks2-iscsi
when: ansible_distribution == 'Fedora' and test_dependencies|bool

####### CentOS 9/10
Expand Down Expand Up @@ -99,6 +100,7 @@
- stratisd
- stratis-cli
- libblockdev-tools
- udisks2-iscsi
when: ansible_distribution == 'CentOS' and test_dependencies|bool

- name: Install additional test dependencies (CentOS 9)
Expand Down
2 changes: 1 addition & 1 deletion plans/tests.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ prepare:
execute:
how: tmt
script:
- sudo python3 tests/run_tests.py -l
- sudo python3 tests/run_tests.py -l -j
- tmt-file-submit -l /tmp/blivet.log
6 changes: 6 additions & 0 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,16 @@ def addFailure(self, test, err): # pylint: disable=redefined-outer-name
argparser.add_argument("-d", "--log-dir", dest="logdir",
help="directory for saving the logs (defaults to /tmp)",
action="store")
argparser.add_argument("-j", "--jenkins", dest="jenkins",
help="run also tests that should run only in a CI environment",
action="store_true")
args = argparser.parse_args()

testdir = os.path.abspath(os.path.dirname(__file__))

if args.jenkins:
os.environ["JENKINS_HOME"] = testdir # pylint: disable=environment-modify

import blivet
print("Running tests with Blivet %s from %s" % (blivet.__version__,
os.path.abspath(os.path.dirname(blivet.__file__))),
Expand Down
2 changes: 2 additions & 0 deletions tests/storage_tests/iscsi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def setUp(self):
except RuntimeError as e:
raise RuntimeError("Failed to setup targetcli device for testing: %s" % e)

subprocess.call(["systemctl", "start", "iscsi-init.service"], stdout=subprocess.DEVNULL)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Consider asserting that iscsi-init.service started successfully.

The test setup does not verify if 'iscsi-init.service' starts successfully, which could cause tests to run in an invalid state. Please check the return code and fail early if the service fails to start.

Suggested change
subprocess.call(["systemctl", "start", "iscsi-init.service"], stdout=subprocess.DEVNULL)
ret = subprocess.call(["systemctl", "start", "iscsi-init.service"], stdout=subprocess.DEVNULL)
if ret != 0:
raise RuntimeError("Failed to start iscsi-init.service (systemctl exit code: %d)" % ret)


def _force_logout(self):
subprocess.call(["iscsiadm", "--mode", "node", "--logout", "--name", self.dev], stdout=subprocess.DEVNULL)

Expand Down