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

[watermarkstat] Add unit tests for watermarkstat show commands #1157

Merged
merged 6 commits into from
Oct 14, 2020

Conversation

neethajohn
Copy link
Contributor

- What I did
Added unit tests for watermarkstat show commands

- How to verify it

platform linux2 -- Python 2.7.16, pytest-3.10.1, py-1.7.0, pluggy-0.8.0 -- /usr/bin/python2
cachedir: .pytest_cache
rootdir: /sonic/src/sonic-utilities/tests, inifile: pytest.ini
plugins: cov-2.6.0
collected 10 items                                                                                                                                                                                                                      

tests/watermarkstat_test.py::TestWatermarkstat::test_show_pg_shared_wm PASSED                                                                                                                                                     [ 10%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_pg_headroom_wm PASSED                                                                                                                                                   [ 20%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_queue_unicast_wm PASSED                                                                                                                                                 [ 30%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_queue_multicast_wm PASSED                                                                                                                                               [ 40%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_buffer_pool_wm PASSED                                                                                                                                                   [ 50%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_pg_shared_peristent_wm PASSED                                                                                                                                           [ 60%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_pg_headroom_persistent_wm PASSED                                                                                                                                        [ 70%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_queue_unicast_persistent_wm PASSED                                                                                                                                      [ 80%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_queue_multicast_persistent_wm PASSED                                                                                                                                    [ 90%]
tests/watermarkstat_test.py::TestWatermarkstat::test_show_buffer_pool_persistent_wm PASSED                                                                                                                                        [100%]

======================================================================================================= 10 passed in 1.76 seconds =======================================================================================================

Signed-off-by: Neetha John <nejo@microsoft.com>
Signed-off-by: Neetha John <nejo@microsoft.com>
Signed-off-by: Neetha John <nejo@microsoft.com>
Signed-off-by: Neetha John <nejo@microsoft.com>
Signed-off-by: Neetha John <nejo@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 10, 2020

This pull request introduces 1 alert when merging 0bccf33 into e1244a5 - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: Neetha John <nejo@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 10, 2020

This pull request introduces 1 alert when merging 7ec4c19 into e1244a5 - view on LGTM.com

new alerts:

  • 1 for Unused import

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/python
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ran into this error in PR tests after #1151 was merged,
/usr/bin/env: 'python': No such file or directory
https://sonic-jenkins.westus2.cloudapp.azure.com/job/common/job/sonic-utilities-build-pr/2537/console

Had to change the path to fix it

Copy link
Contributor

Choose a reason for hiding this comment

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

That's strange. #1151 shouldn't have had an impact on this. Also, all other executable scripts in the repo still use #!/usr/bin/env python. I feel like this change shouldn't be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how to fix the build failure. seems to be failing every time utilities wheel is built. But if I retain the docker and run the test again using 'python setup.py test', I don't see the issue

Copy link
Contributor

@jleveque jleveque Oct 12, 2020

Choose a reason for hiding this comment

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

It sounds like it may be a PATH difference with the sonic-utilities build job in sonic-build-tools. But I'm surprised no other tests are failing like this. You're executing the watermarkstat script explicitly in the tests. Are other unit tests doing this? If so, I would expect them to fail, also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not executing the command directly. I am using 'show' commands to invoke that script. The same format is used in many of the utilities tests which are invoking modules under 'scripts' path and some of them also use "/usr/bin/env python". I fail to understand what is special about this particular script

@lguohan
Copy link
Contributor

lguohan commented Oct 13, 2020

what is pending here? can we merge this?

@jleveque
Copy link
Contributor

@lguohan: I find it odd that Neetha needed to modify the shebang in this file. I would like to understand this better, as it shouldn't be necessary. If you'd like, we can merge this as-is, and @neethajohn can continue to investigate offline.

@neethajohn
Copy link
Contributor Author

@lguohan, can I go ahead with the merge?

@jleveque
Copy link
Contributor

jleveque commented Oct 14, 2020

I'm OK with merging this, but I'd like to understand further what changed to require this shebang to change.

NJ> I will investigate offline

@neethajohn neethajohn merged commit a733df5 into sonic-net:master Oct 14, 2020
@neethajohn neethajohn deleted the wmstat_test branch October 14, 2020 20:45
@abdosi
Copy link
Contributor

abdosi commented Oct 30, 2020

@neethajohn Please create PR for 201911

@jleveque
Copy link
Contributor

@neethajohn, @lguohan: I believe I found the root cause of the shebang issue. I have opened a PR to fix here: #1233

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.

5 participants