-
Notifications
You must be signed in to change notification settings - Fork 738
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 marks]: the matching rule of conditional marks take only one conditional, for same mark from different files #16016
Comments
@yutongzhang-microsoft please make an architectural call on this issue. I am leaning towards to agree that a single condition should be placed in one file only. Can we have a unit test to prevent/warn such scenarios? @AntonHryshchuk can you share the use case regarding why a single test's skip conditions should be put into 2 files? |
Hi, @yxieca , we are not allow to duplicate conditions exist in a file, but we don't have a unit test to such scenrios. @AntonHryshchuk , |
Hi @yxieca @yutongzhang-microsoft, Actually the problem we have is in the longest match logic, because we have our internal skip yaml files and there could be exactly the same entry as in the community files. sonic-mgmt/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml Lines 62 to 85 in f1de2fa
In these skips, if we want to skip test case bfd/test_bfd.py::test_bfd_basic, we need also add the conditions of bfd/test_bfd.py. And why do we have this issue now, because actually there was a bug in the longest match logic(it took all conditions actually, not only the longest one) and the PR(#14395) fix it(we only merged this PR to our local repo recently). So may I propose a new approach instead of longest match? We can collect all the matches, and then sort them by length on the mark(skip, xfail, etc.) basis, and then evaluate the conditions from the longest match to the shortest. Whenever the condition is True, we add the mark and break.
When running the test case test_bfd_echo_mode, it will firstly evaluate the condition of the issue, and then the release and platform. If you agree with this approach, we can commit it. Please share your thoughts. Thanks. |
@congh-nvidia can you book a meeting with @yutongzhang-microsoft to have a discussion? Your example should have been covered by existing logic already. Your requirement of having private condition file is valid. If we figure out a way to specify which file should take higher priority, does that solve your issue too? |
Issue Description
Introduced in #14395,
After the change, if a similar mark exists in different files, only the last (alphabet order) will be taken.
In same length of case.
A.yaml:
B.yaml:
previously, the method
find_longest_matches
returned:[{'packge/test.py':{'skip':{'condition':["conditionA"]}}}, {'packge/test.py':{'skip':{'condition':["conditionB"]}}}]
Now the return value of the method
find_all_matches
will be[{'packge/test.py':{'skip':{'condition':["conditionB"]}}}]
Results you see
only last condition taken
Results you expected to see
if several files have the same length of case and same mark, all these skip conditions will be taken
Is it platform specific
generic
Relevant log output
No response
Output of
show version
No response
Attach files (if any)
No response
The text was updated successfully, but these errors were encountered: