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

Fix IOS interface link template uptime issue #1855

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

paulbauer1
Copy link
Contributor

@paulbauer1 paulbauer1 commented Sep 24, 2024

Corrected issue with template not displaying uptime values correctly when there are hours in the uptime value. Added optional hours to the uptime regex statement.

@itdependsnetworks
Copy link
Contributor

Can you add tests as well?

We follow a simple mock and verify value setup, you can see a recent example here: https://github.com/networktocode/ntc-templates/pull/1841/files and documentation of the process here: https://ntc-templates.readthedocs.io/en/latest/dev/dev_parser/#tests

Essentially we are looking for new output that shows your new condition, while ensuring that there is no regressions to other conditions. This also protects your update in the future, in case someone were to inadvertently revert your change.

@paulbauer1
Copy link
Contributor Author

paulbauer1 commented Sep 25, 2024

I added a new test file, tests/cisco_ios/show_interface_link/cisco_ios_show_interface_link4.raw. It is basically the same as the existing first raw file just with a newly generated yaml file to go with it. The existing test file (tests/cisco_ios/show_interface_link/cisco_ios_show_interface_link.raw) already contained the necessary data to validate my changes. Although, now the existing raw and yaml files fail testing as the bug I fixed had created bad data in the existing yaml file so that now fails. The tests/cisco_ios/show_interface_link/cisco_ios_show_interface_link.yaml file is no longer a valid yaml file now that the bug has been resolved. What should be done with the existing test files that now fail? Thank you.

@jmcgill298
Copy link
Contributor

@paulbauer1 if the existing test cases are already symptomatic of the problem, then you just need to update the existing test cases with the correct values, and do not need to create a new test case

@paulbauer1
Copy link
Contributor Author

I regenerated the cisco_ios_show_interface_link.yaml file. The other files were fine. All tests passed.

============================================================================================== 2340 passed in 16.03s ==============================================================================================
All tests have passed!

Copy link
Contributor

@jmcgill298 jmcgill298 left a comment

Choose a reason for hiding this comment

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

I created a PR back to you to fix the downtime not getting captured paulbauer1#1

@jmcgill298 jmcgill298 merged commit f591cb0 into networktocode:master Sep 26, 2024
14 checks passed
@jmcgill298
Copy link
Contributor

thanks @paulbauer1

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.

3 participants