-
Notifications
You must be signed in to change notification settings - Fork 61
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
Refactor: Pytest refactoring and fixes for system test cases #414
Conversation
135ee4c
to
27ce04b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR! Please find below my comments.
-
The Makefile config.py rule did not get updated (still create the config.py for the on-prem CVP).
We should update it to move away from on-prem IMHO - i.e. remove username, password and just have 2 fields:
server and token. -
The git pre-commit validation failed because an extra line has been added at the end of the file
tests/system/test_cv_device_tools_fqdn.py
-
system/test_cv_container_tools.py
> OK -
system/test_cv_device_tools_fqdn.py
> OK -
system/test_cv_device_tools_generic.py
> OK -
system/test_cv_device_tools_serial.py
> OK -
system/test_cv_device_tools.py
> OK but 2 skip.
As mentionned, we can move one of the device to the undefinied container before running those tests by removing them from the inventory (CVaaS now automatically add the devices to the provisioning page).
Sample example:
>>> from lib import config
>>> from cvprac.cvp_client import CvpClient
>>> cvp_client.connect(
... nodes=[config.server],
... username=config.username,
... password=config.password,
... is_cvaas=True,
... api_token=config.user_token
... )
>>> cvp_client.api.delete_device('50:00:00:cb:38:c2')
{'result': 'success'}
- As a future improvement (maybe in a future PR), we could also add tests for device search by:
- hostname
- serial number
This is not yet covered by the test suite as of now.
27ce04b
to
b9379e6
Compare
b9379e6
to
f8b7d1c
Compare
@guillaumeVilar : Thanks for the code review. I have updated the PR as per your suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
ansible_collections/arista/cvp/plugins/module_utils/container_tools.py
Outdated
Show resolved
Hide resolved
f8b7d1c
to
0c38d48
Compare
0c38d48
to
3ff61f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the PR. System tests now all passed, awesome!
A small detail, the Makefile was not updated with the changes:
AUTH_CONFIG_FILE = lib/config.py
define AUTH_CONFIG
#!/usr/bin/python
# coding: utf-8 -*-
username = "< username >"
password = "< password >"
server = "< cloudvision ip >"
endef
export AUTH_CONFIG
Moreover, I tried the other rules and are not triggering the system tests:
make ci
> only run the unit testsmake test
> samemake test-api
> Give error:
===================================================================================================== no tests ran in 0.88s ======================================================================================================
ERROR: Wrong expression passed to '-m': generic,api: at column 8: unexpected character ","
make: *** [Makefile:32: test-api] Error 4
3ff61f2
to
63b5ae6
Compare
63b5ae6
to
88560ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Awesome work!
Change Summary
Pytest refactoring
Related Issue(s)
Fixes #N/A
Component(s) name
Pytest
Proposed changes
Define a clear structure to separate:
tests/unit
tests/system
tests/lib
How to test
Checklist
User Checklist
Repository Checklist