-
Notifications
You must be signed in to change notification settings - Fork 94
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
Cleanup translib and cvl go test cases #13
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Default cvl schema path is now same as the install path. Env varibale CVL_SCHEMA_PATH need not be set if schema files are installed from sonic-mgm-common.deb package. This simplifies testing.
Modified transformer to accept custom yang search path through env variable YANG_MODELS_PATH. Falls back to default path /usr/models/yang if this env variable is not set. Helps quick testing without install.
1) Introduced new test app module api_tests_app.go which handles paths starting with "/api-tests:". It returns success or error based on data in the path. Useful for testing end-to-end functionality from translib clients, like REST server, without depending on actual app modules. 2) api_tests_app.go will compile only when build tag "test" is set. Translib makefile sets it during translib test binary compilation only. 3) Temporarily excluded ACL app test code from translib test binary. It will be added back later once all errors are fixed. ACL app tests can still be run from source. Moved TestMain function and common utilities to a new app_utils_test.go go file. Signed-off-by: Sachin Holla <[email protected]>
renukamanavalan
pushed a commit
to sonic-net/sonic-mgmt-framework
that referenced
this pull request
Jul 15, 2020
Why I did it REST go tests were failing due to failures in ACL request. - How I did it 1) Modified ProcessXXX testcases to use new api-tests app instead of ACL app. This allows running end-to-end positive and negative tests without depending on db state and ACL logic. Added few more test cases. Depends on sonic-net/sonic-mgmt-common#13. 2) Added few more negative test cases to test translib integration. 3) Added a new tool rest-gotest.sh to run REST server tests from source or already built test binary. Can be used with tparse or gotestsum too. rest-gotest.sh /* run all tests from source */ rest-gotest.sh -bin /* run already built test binary */ rest-gotest.sh -run Process /* run only ProcessXXX tests */ rest-gotest.sh -bin -json | tparse gotestsum -f testname --raw-command -- rest-gotest.sh -json - How to verify it REST server gotest - Description for the changelog Use translib's new api-tests app in REST gotest
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- Why I did it
There are few issues in cvl and translib go test code.
- How I did it
1) Fixed compilation is translib test code. Temporarily disabled ACL test codes from translib test since there are too many errors in it. Moved all common utility code in ACL test file into a new common file (app_utils_test.go).
2) Fixed the failures in cvl test code.
3) Added a new app module api_tests_app.go which provides dummy implementations of all app interface APIs for paths starting with
/api-tests:
. Errors can be simulated by including token/error/
in the path. This can be used by translib test code as well as translib client test code (REST or telemetry) to verify end-to-end of all cases without depending on actual app modules or database state.- How to verify it
Run translib and cvl go test cases
- Description for the changelog
Cleanup translib and cvl go test cases