Skip to content

Conversation

@pszulczewski
Copy link
Collaborator

@pszulczewski pszulczewski commented Dec 10, 2021

This PR is about issue #8

Proposed mock file structure:

$ pwd
netcompare/tests/mock
$ tree
.
├── api
│   ├── post.json
│   ├── pre.json
├── exact_match_nested
│   ├── post.json
│   ├── pre.json
├── napalm_get_bgp_neighbors
│   ├── post.json
│   ├── pre.json
├── napalm_get_lldp_neighbors
│   ├── post.json
│   ├── pre.json
├── napalm_getter
│   ├── post.json
│   ├── pre.json
├── napalm_getter_additional_peer
│   ├── post.json
│   ├── pre.json
├── napalm_getter_changed_peer
│   ├── post.json
│   ├── pre.json
├── napalm_getter_missing_peer
│   ├── post.json
│   ├── pre.json
├── raw_novalue_exclude
│   ├── post.json
│   ├── pre.json
├── raw_novalue_noexclude
│   ├── post.json
│   ├── pre.json
├── raw_value_exclude
│   ├── post.json
│   ├── pre.json
└── textfsm
    ├── post.json
    ├── pre.json

Another function was added to tests/utils.py to load all mocks at once.
These three mocks are:
pre - precheck data
post - postcheck data

@lvrfrc87
Copy link
Collaborator

What about reduce the number of files to 1 (per post and pre) per parser type textfsm, api, getters, etc ?

@pszulczewski
Copy link
Collaborator Author

What about reduce the number of files to 1 (per post and pre) per parser type textfsm, api, getters, etc ?

I am not sure if I like it. Now you can easily compare two files side-by-side and verify test results. If we merge them that will be much harder.

@chadell
Copy link
Contributor

chadell commented Dec 10, 2021

what about classifying the test based on the type? (exact_match, tolerance, params, etc.)

@pszulczewski
Copy link
Collaborator Author

what about classifying the test based on the type? (exact_match, tolerance, params, etc.)

Sorry not clear to me. We already have tests for different checktype in test_check_type do you want rename mocks to follow that tests names?

@pszulczewski
Copy link
Collaborator Author

I have moved expected results from json files to test files. This data is not json and it is confusing to keep it with mocks in json format.

@chadell
Copy link
Contributor

chadell commented Dec 13, 2021

what about classifying the test based on the type? (exact_match, tolerance, params, etc.)

Sorry not clear to me. We already have tests for different checktype in test_check_type do you want rename mocks to follow that tests names?

don't mind, I actually think that maybe the mocks will be used in different tests, so no need to partition them.
I think that the results are better to come togehter with the test, because the same pre/post data could have different result depending on the test

chadell
chadell previously approved these changes Dec 13, 2021
Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

LGTM

@lvrfrc87 lvrfrc87 merged commit abeaab8 into main Dec 16, 2021
@lvrfrc87 lvrfrc87 deleted the 8_tidy_up_mocks branch December 16, 2021 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants