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

[pytest][qos][config] Added pytests for "config qos reload" commands #1266

Merged
merged 12 commits into from
Dec 23, 2020

Conversation

smaheshm
Copy link
Contributor

- What I did
Added pytests for "config qos reload" commands for single and multi ASIC platforms.

- How I did it
Since 'config qos reload' command invokdes'sonic-cfggen' process, add a "--dry-run" option to 'config qos reload' command so that it passes the right parameters to 'sonic-cfggen' to not 'read and write' to config DB in unit test env. Also added '--json-data' option that gives flexibility to test variable parameters like tiers and switch roles.

- How to verify it

Unit test.

======================================
samaddik@83f02bcc27aa:/sonic/src/sonic-utilities/tests$ pytest-3  -s -k reload
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
rootdir: /sonic/src/sonic-utilities/tests, inifile: pytest.ini
plugins: cov-2.6.0
collected 337 items / 335 deselected

config_test.py SETUP
Saving output in /tmp/qos_config_output.json
0
Running command: /usr/local/bin/sonic-cfggen  --additional-data '{"DEVICE_METADATA": {"localhost": {}}}' -t /sonic/src/sonic-utilities/tests/qos_config_input/buffers.json.j2,/tmp/qos_config_output.json -t /sonic/src/sonic-utilities/tests/qos_config_input/qos.json.j2,/tmp/qos_config_output.json -y /sonic/src/sonic-utilities/tests/qos_config_input/sonic_version.yml

.TEARDOWN
SETUP
Saving output in /tmp/qos_config_output.json<0,1,2..>
0
Running command: /usr/local/bin/sonic-cfggen -n asic0 --additional-data '{"DEVICE_METADATA": {"localhost": {}}}' -t /sonic/src/sonic-utilities/tests/qos_config_input/0/buffers.json.j2,/tmp/qos_config_output.json0 -t /sonic/src/sonic-utilities/tests/qos_config_input/0/qos.json.j2,/tmp/qos_config_output.json0 -y /sonic/src/sonic-utilities/tests/qos_config_input/sonic_version.yml
Running command: /usr/local/bin/sonic-cfggen -n asic1 --additional-data '{"DEVICE_METADATA": {"localhost": {}}}' -t /sonic/src/sonic-utilities/tests/qos_config_input/1/buffers.json.j2,/tmp/qos_config_output.json1 -t /sonic/src/sonic-utilities/tests/qos_config_input/1/qos.json.j2,/tmp/qos_config_output.json1 -y /sonic/src/sonic-utilities/tests/qos_config_input/sonic_version.yml

.TEARDOWN


=================== 2 passed, 335 deselected in 1.51 seconds ===================

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm smaheshm marked this pull request as ready for review December 3, 2020 18:47
@smaheshm
Copy link
Contributor Author

smaheshm commented Dec 8, 2020

👋

@smaheshm
Copy link
Contributor Author

smaheshm commented Dec 9, 2020

retest this please

1 similar comment
@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm
Copy link
Contributor Author

Gentle reminder @neethajohn @abdosi

tests/conftest.py Show resolved Hide resolved
tests/mock_tables/mock_multi_asic.py Show resolved Hide resolved
tests/config_test.py Show resolved Hide resolved
tests/config_test.py Show resolved Hide resolved
@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm
Copy link
Contributor Author

retest this please

3 similar comments
@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm
Copy link
Contributor Author

retest this please

@smaheshm smaheshm merged commit 6202a81 into sonic-net:master Dec 23, 2020
lguohan added a commit that referenced this pull request Dec 27, 2020
@lguohan
Copy link
Contributor

lguohan commented Dec 27, 2020

this commit caused vkm test failure https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-image-pr/8207/

it is reverted, can you resubmit the pr?

@smaheshm
Copy link
Contributor Author

this commit caused vkm test failure https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-image-pr/8207/

it is reverted, can you resubmit the pr?

taking a look, will resubmit.

@smaheshm
Copy link
Contributor Author

smaheshm commented Jan 4, 2021

this commit caused vkm test failure https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-image-pr/8207/
it is reverted, can you resubmit the pr?

taking a look, will resubmit.

Added the offending API
sonic-net/sonic-buildimage#6309

smaheshm added a commit to smaheshm/sonic-utilities that referenced this pull request Jan 4, 2021
…eload" commands (sonic-net#1266)""

This reverts commit de14939.

The commit was reverted due to a failure in sonic-buildimage unit tests,
which was due to an un-implemented API. This is now fixed in
PR #6309 (sonic-buildimage)
@smaheshm smaheshm deleted the config_qos branch February 26, 2021 22:33
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
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