Skip to content
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

Conditional skip of stopping resources in interactive mode #1018

Closed

Conversation

M6AI
Copy link
Contributor

@M6AI M6AI commented Nov 8, 2023

Bug / Requirement Description

If an environment is started then stopped in interactive mode, then the abort would once again initiate the full stop for the environment, resulting in duplicated work and a UID clash for before and after stop hooks.

Solution description

Added a simple conditional skip of this step based on environment status.

Checklist:

  • Test
  • Example (both test_plan.py and .rst)
  • Documentation (API)
  • News fragment present for release notes
  • MS info leakage check
  • For new driver: driver index page
  • For new assertion: ui/pdf/std renderers, documentation
  • For new cmdline arg: documentation

@M6AI M6AI requested a review from Pyifan as a code owner November 8, 2023 07:54
@@ -709,6 +709,8 @@ def stop_test_resources(self):
interactive mode where a test environment may be stopped on-demand.
Handles running before/after_stop callables if required.
"""
if self.report.env_status == entity.ResourceStatus.STOPPED:
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Abort explicitly calls stopping of test resources, we need the skip here.

@@ -513,6 +513,9 @@ def stop_test_resources(self, test_uid, await_results=True):
if not await_results:
return self._run_async(self.stop_test_resources, test_uid)

if self.report[test_uid].env_status == entity.ResourceStatus.STOPPED:
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a performance boost in general, if something is stopped we simply skip the entire process. Not sure if there is a way to trigger another stop of the environment resources than usual (in which case the button status protects us), but just to be sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's better that we check env_status not in [STOPPING, STOPPED]

@@ -513,6 +513,9 @@ def stop_test_resources(self, test_uid, await_results=True):
if not await_results:
return self._run_async(self.stop_test_resources, test_uid)

if self.report[test_uid].env_status == entity.ResourceStatus.STOPPED:
return
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better that we check env_status not in [STOPPING, STOPPED]

@@ -709,6 +709,8 @@ def stop_test_resources(self):
interactive mode where a test environment may be stopped on-demand.
Handles running before/after_stop callables if required.
"""
if self.report.env_status == entity.ResourceStatus.STOPPED:
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems report.env_status is not something that we handle at Test or Multitest level. It is currently handled by TestRunnerIHandler. Or maybe we can move this state transition logic to Test. Anyway, it's better we set and check in the same class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I addressed the other two comments. I think the Environment itself should know about the overall status of its drivers and derive from that. It does not seem to me a Test or MultiTest level thing, only if it derives from the actual environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, there are now 5 failures across various testcases all relying on the fact that STOPPING is also considered as a skip condition. Let us discuss offline.

@M6AI M6AI closed this Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants