-
Notifications
You must be signed in to change notification settings - Fork 87
tests: Make sure iscsi-init.service is started for iSCSI tests #1411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: Make sure iscsi-init.service is started for iSCSI tests #1411
Conversation
Reviewer's GuideThis PR enhances the iSCSI test setup by adding a Jenkins mode flag, ensuring the iscsi-init service is started in tests, and including the udisks2-iscsi package as a test dependency in Ansible playbooks. Sequence diagram for starting iscsi-init.service in iSCSI test setupsequenceDiagram
participant TestRunner
participant Systemd
participant iSCSIService as iscsi-init.service
TestRunner->>Systemd: Start iscsi-init.service (in setUp)
Systemd->>iSCSIService: Activate service
iSCSIService-->>Systemd: Service started
Systemd-->>TestRunner: Confirmation of service start
TestRunner->>TestRunner: Proceed with iSCSI tests
Class diagram for updated iSCSI test setupclassDiagram
class ISCSITest {
+setUp()
+test_iscsi_functionality()
}
ISCSITest : +setUp() now starts iscsi-init.service
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @vojtechtrefny - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This includes tests that are skipped when running in non-CI environment.
dffccbd
to
a52d4ee
Compare
11aedca
to
a52d4ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @vojtechtrefny - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `tests/storage_tests/iscsi_test.py:115` </location>
<code_context>
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)
+
def _force_logout(self):
</code_context>
<issue_to_address>
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.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
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)
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -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) |
There was a problem hiding this comment.
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.
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) |
Summary by Sourcery
Add support for CI-specific tests and improve iSCSI test setup
New Features:
Enhancements: