Skip to content

Test Completeness enhancements - new diagnose level and helper methods#2149

Merged
vaibhavhd merged 5 commits intosonic-net:masterfrom
vaibhavhd:completeness-improvements
Sep 3, 2020
Merged

Test Completeness enhancements - new diagnose level and helper methods#2149
vaibhavhd merged 5 commits intosonic-net:masterfrom
vaibhavhd:completeness-improvements

Conversation

@vaibhavhd
Copy link
Contributor

Description of PR

Summary: Enhancements to test-completeness-infra
Fixes # (issue)

Type of change

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

Approach

What is the motivation for this PR?

Changes:

  1. New level - 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 as debug level, which is intended to take a sample test to debug test code. diagnose level is to diagnose sonic feature/behavior.
  2. New completeness handler for getting the normalized level from the request attribute.
  3. New completeness handler to get level name in str type from the type CompletenessLevel.
  4. Modified usage of completeness level in test_link_flap testcase.

How did you verify/test it?

Tested test_link_flap testcase successfully.

Any platform specific information?

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

Documentation

@vaibhavhd vaibhavhd self-assigned this Aug 27, 2020
@vaibhavhd vaibhavhd requested a review from a team August 27, 2020 21:29
Copy link
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

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

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

diagnose level 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline at the end. (I know you didn't add this but since we're here. 😄)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Comment on lines +15 to +19
"""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)
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a few suggestions here:

  1. Separate the summary line and the example
  2. Generalize the description a little bit (i.e. describe what is happening rather than how it is happening)
  3. Explicitly call out the return type

One possible interpretation:

Suggested change
"""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
"""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incorporated the suggestion. Thanks!

Comment on lines +29 to +32
"""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
Copy link
Contributor

Choose a reason for hiding this comment

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

Just some minor formatting changes:

Suggested change
"""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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incorporated the suggestion. Thanks!

@vaibhavhd vaibhavhd requested a review from daall September 1, 2020 18:20
basic = 1
confident = 2
thorough = 3 # Maximum execution
diagnose = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

@vaibhavhd vaibhavhd Sep 1, 2020

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to keep the change minimal, you can assign diagnose some int value since its treated differently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean any int value other than 0?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes. some large value leaving enough space after max level in case we need to add more ordered levels in future

@vaibhavhd vaibhavhd requested a review from neethajohn September 2, 2020 18:58
@vaibhavhd
Copy link
Contributor Author

retest vsimage please

@vaibhavhd vaibhavhd merged commit 96466d5 into sonic-net:master Sep 3, 2020
@vaibhavhd vaibhavhd deleted the completeness-improvements branch September 3, 2020 06:30
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
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]>
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.

3 participants