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

handling empty or missing snapshots #413

Closed
nbujic-jnpr opened this issue May 28, 2024 · 1 comment
Closed

handling empty or missing snapshots #413

nbujic-jnpr opened this issue May 28, 2024 · 1 comment
Assignees
Labels

Comments

@nbujic-jnpr
Copy link

Description of Issue/Question

Hi,

If it happens that snapshot file is non-existing/empty, following issues can happen:

  1. for missing/empty post snapshot test will be always skipped, which is different compared to empty pre-snapshot where missing data/nodes can be identifed and test will fail in that case (if not ignore-null is set)
  2. for missing/empty pre snapshot if one of 4 "compare" checks is used, since in code data from post-snapshot is assigned to pre-snapshot test will pass reporting that there are no differences

Steps to Reproduce Issue 1.

  • execute -snap pre
  • execute --snap post and remove some of the snapshot files or use command which will generate empty output
  • execute --compare pre post
# jsnapy --snap pre
Connecting to device 10.220.1.222 ................
Taking snapshot of COMMAND: show chassis hardware
# jsnapy --check pre post
**************************** Device: 10.220.1.222 ****************************
Tests Included: test_chassis_hardware
*********************** Command: show chassis hardware ***********************
ERROR, Snapshot file /root/jsnapy/snapshots/10.220.1.222_22_post_show_chassis_hardware.xml is not present in given path !!
------------------------------- Final Result!! -------------------------------
test_chassis_hardware : Skipped
Total No of tests passed: 0
Total No of tests failed: 0
None of the test cases executed !!!

Steps to Reproduce Issue 2.

  • execute only --snap post or execute --snap pre and remove some of the related snapshot files
  • execute --check pre post with tests containing "compare" operators
# jsnapy --snap post
Connecting to device 10.220.1.222 ................
Taking snapshot of COMMAND: show chassis hardware
# jsnapy --check pre post
**************************** Device: 10.220.1.222 ****************************
Tests Included: test_chassis_hardware
*********************** Command: show chassis hardware ***********************
ERROR, Snapshot file /root/jsnapy/snapshots/10.220.1.222_22_pre_show_chassis_hardware.xml is not present in given path !!
PASS | All "serial-number" is same in pre and post snapshot [ 1 value matched ]
------------------------------- Final Result!! -------------------------------
test_chassis_hardware : Passed
Total No of tests passed: 1
Total No of tests failed: 0
Overall Tests passed!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants