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

[action] [PR:15977] Update the conditional mark skip logic to support regular expression #17336

Open
wants to merge 1 commit into
base: 202411
Choose a base branch
from

Conversation

mssonicbld
Copy link
Collaborator

Description of PR

Summary:
This change is to support matching the test by regular expression in the conditional mark logic.
Sometimes we need to skip a test by a pytest parameter in the testcase name, which is not supported by the current longest match logic.
For example:
autorestart/test_container_autorestart.py::test_containers_autorestart[dut01-None-teamd]
If we only want to skip the teamd test case in the test test_container_autorestart.py, we are not able to do that because the first parameter is the dut name and it is different with different testbeds.
With this change, we are able to match the test case name by using a regex pattern, so that the teamd test case can be easily skipped.
The example of the skip condition is like this:

autorestart/test_container_autorestart.py::test_containers_autorestart.*teamd: #regex pattern
 regex: True #key "regex" with a bool type value
 skip:
 reason: "Testcase ignored due to issue: https://github.com/sonic-net/sonic-buildimage/issues/xxxxx"
 conditions:
 - https://github.com/sonic-net/sonic-buildimage/issues/xxxxx

This change is totally backward compatible, we need to add a "regex: True" in the condition to enable the regex match. For the existing conditions, the logic is the same as before.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

Update the conditional mark skip logic to support regular expression

How did you do it?

Please see the summary

How did you verify/test it?

Run regression with this change and skipped conditions with the regex key, no issues observed.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

)

- What is the motivation for this PR?
Update the conditional mark skip logic to support regular expression

- How did you do it?
Please see the summary

- How did you verify/test it?
Run regression with this change and skipped conditions with the regex key, no issues observed.
@mssonicbld
Copy link
Collaborator Author

/azp run

@mssonicbld
Copy link
Collaborator Author

Original PR: #15977

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants