Test Completeness enhancements - new diagnose level and helper methods#2149
Conversation
daall
left a comment
There was a problem hiding this comment.
LGTM, just a few clarification points.
| Thorough | ||
| thorough | ||
|
|
||
| An unordered level `diagnose` is also supported. If `diagnose` level is specified and a test doesn’t support it, then it shall fall back to `basic` mode. This level doesn’t have any implication of above or below any existing level. Furthermore, this level is not the same as `debug` level, which is intended to take a sample test to debug test code. `diagnose` level is to be used to diagnose sonic feature/behavior. |
There was a problem hiding this comment.
diagnoselevel is used to diagnose sonic feature/behavior.
Can you clarify this some more? I think it is still a little confusing what the difference is between this new level and the existing levels. Maybe an example use-case would help?
There was a problem hiding this comment.
Improved the description and described what the level is ideally meant for.
| tlf = TestLinkFlap() | ||
| tlf.run_link_flap_test(duthost, fanouthosts, normalized_level) No newline at end of file | ||
| tlf = TestLinkFlap(request) | ||
| tlf.run_link_flap_test(duthost, fanouthosts) No newline at end of file |
There was a problem hiding this comment.
Missing newline at the end. (I know you didn't add this but since we're here. 😄)
| """Takes a request instance and returns normalized completeness level in string format. | ||
| For example, if a testcase supports "CompletenessLevel.basic, CompletenessLevel.thorough", and specified level | ||
| during test execution is "confident", this method will make use of normalization logic during | ||
| pytest_runtest_setup and returns the normalized level as "basic" (str type of CompletenessLevel.basic) | ||
| """ |
There was a problem hiding this comment.
I have a few suggestions here:
- Separate the summary line and the example
- Generalize the description a little bit (i.e. describe what is happening rather than how it is happening)
- Explicitly call out the return type
One possible interpretation:
| """Takes a request instance and returns normalized completeness level in string format. | |
| For example, if a testcase supports "CompletenessLevel.basic, CompletenessLevel.thorough", and specified level | |
| during test execution is "confident", this method will make use of normalization logic during | |
| pytest_runtest_setup and returns the normalized level as "basic" (str type of CompletenessLevel.basic) | |
| """ | |
| """Get the normalized completeness level for a given test instance. | |
| For example, if a testcase supports "CompletenessLevel.basic, CompletenessLevel.thorough", and the specified level | |
| during test execution is "confident", then this method will normalize the level to "basic". | |
| Returns: | |
| CompletenessLevel as a string | |
| """ |
There was a problem hiding this comment.
Incorporated the suggestion. Thanks!
| """Converts a type CompletenessLevel to type str. | ||
| For example, if input is CompletenessLevel.basic, this method will return "basic" | ||
| Arguments: | ||
| level - An enum value of type CompletenessLevel |
There was a problem hiding this comment.
Just some minor formatting changes:
| """Converts a type CompletenessLevel to type str. | |
| For example, if input is CompletenessLevel.basic, this method will return "basic" | |
| Arguments: | |
| level - An enum value of type CompletenessLevel | |
| """Converts a type CompletenessLevel to type str. | |
| For example, if input is CompletenessLevel.basic, this method will return "basic." | |
| Arguments: | |
| level - An enum value of type CompletenessLevel |
There was a problem hiding this comment.
Incorporated the suggestion. Thanks!
| basic = 1 | ||
| confident = 2 | ||
| thorough = 3 # Maximum execution | ||
| diagnose = 0 |
There was a problem hiding this comment.
you did mention this is an unordered level. do you need to shift the other levels in that case? Wouldn't specifying some value for 'diagnose' level suffice?
There was a problem hiding this comment.
Any int value can be assigned to diagnose. It has to be int due to base type enum.IntEnum.
During normalization, there is a special handling for diagnose which does not consider ordering.
There was a problem hiding this comment.
I started with enum.IntEnum as the levels were assumed to follow a ordered priority. But this does not seem to be the case anymore. Removing base class inheritance will make this list look simple, but then the downside is we will have to implement methods to handle ordered levels, exists check, etc. These methods are presently used from enum.IntEnum
There was a problem hiding this comment.
Just to keep the change minimal, you can assign diagnose some int value since its treated differently
There was a problem hiding this comment.
Do you mean any int value other than 0?
There was a problem hiding this comment.
yes. some large value leaving enough space after max level in case we need to add more ordered levels in future
|
retest vsimage please |
988d8e172e7140174bfa21d3b86c9685c7127a14 (HEAD -> 201911, origin/201911) [warm-reboot]: added automated recover for ISSU file (sonic-net#1466) 913df4e2faf6e70e0aebb01d81f79694a6d8ee20 [201911] Warmboot script improvements - timeout in exec and disable service-autorestart (sonic-net#2149) Signed-off-by: Abhishek Dosi <[email protected]>
Description of PR
Summary: Enhancements to test-completeness-infra
Fixes # (issue)
Type of change
Approach
What is the motivation for this PR?
Changes:
diagnose- If this level is specified and a test doesn’t support it, then it shall fall back to basic mode. This level doesn’t have any implication of above or below any existing level. This level is not the same asdebuglevel, which is intended to take a sample test to debug test code.diagnoselevel is to diagnose sonic feature/behavior.strtype from the typeCompletenessLevel.test_link_flaptestcase.How did you verify/test it?
Tested
test_link_flaptestcase successfully.Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation