Skip to content

Add commit-ready functional tests under tests/junipernetworks.junos #749

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Brij812
Copy link

@Brij812 Brij812 commented May 5, 2025

This pull request introduces a comprehensive set of functional tests for the Juniper Ansible Collection for Junos (junipernetworks.junos).

Key additions:

  • 37 commit-ready functional test playbooks located under tests/junipernetworks.junos/
  • All playbooks follow official module documentation examples and include states like merged, replaced, overridden, deleted, gathered, rendered, and parsed
  • Clean inventory and ansible.cfg files prepared for netconf, local, and network_cli connection types
  • run_all_tests.sh script to execute all test cases in sequence
  • A detailed README.md with execution instructions

All sensitive values (e.g., IPs, usernames, passwords) have been masked with placeholders (xx.xx.xx.xx) to make the tests reusable and commit-safe.

@chidanandpujar
Copy link
Collaborator

Hi @Brij812,

Please check this failure with pb.juniper_junos_config.yml module.

TASK [Assert backup created] *******************************************************************************************************************
fatal: [10.220.10.59]: FAILED! => {
"assertion": "backup_result.backup_path is defined",
"changed": false,
"evaluated_to": false,
"msg": "Assertion failed"
}

root@masterhost:~/ansible_modules_redirection_test5/ansible-junos-stdlib/ansible_collections# ansible-playbook -i inventory_junos pb.juniper_junos_config.yml 
[WARNING]: errors were encountered during the plugin load for junos_config: ["'NoneType' object has no attribute 'get'"]
[WARNING]: errors were encountered during the plugin load for assert: ["'NoneType' object has no attribute 'get'"]
[WARNING]: errors were encountered during the plugin load for junipernetworks.junos.junos_config: ["'NoneType' object has no attribute 'get'"]

PLAY [Functional Test - junos_config module] ***************************************************************************************************

TASK [Pre-clean - Remove existing test interface description] **********************************************************************************
[WARNING]: errors were encountered during the plugin load for junipernetworks.junos.junos: ["'NoneType' object has no attribute 'get'",
"'NoneType' object has no attribute 'get'"]
changed: [10.220.10.59]

TASK [Assert pre-clean successful] *************************************************************************************************************
ok: [10.220.10.59] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Apply test config - set interface description] *******************************************************************************************
[WARNING]: errors were encountered during the plugin load for junipernetworks.junos.junos: ["'NoneType' object has no attribute 'get'"]
changed: [10.220.10.59]

TASK [Assert interface config applied] *********************************************************************************************************
ok: [10.220.10.59] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Confirm commit test with timer] **********************************************************************************************************
ok: [10.220.10.59]

TASK [Rollback config to rollback 0] ***********************************************************************************************************
changed: [10.220.10.59]

TASK [Backup config to custom path] ************************************************************************************************************
ok: [10.220.10.59]

TASK [Assert backup created] *******************************************************************************************************************
fatal: [10.220.10.59]: FAILED! => {
    "assertion": "backup_result.backup_path is defined",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"
}

PLAY RECAP *************************************************************************************************************************************
10.220.10.59               : ok=7    changed=3    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

@chidanandpujar
Copy link
Collaborator

Hi @Brij812
please add failed test case details to fail log file,

❌ pb.juniper_junos_vlans.yml failed with status 4
-----------------------------------------------------
Running pb.juniper_junos_vrf.yml
[WARNING]: errors were encountered during the plugin load for junipernetworks.junos.junos_config: ["'NoneType' object has no attribute 'get'"]
[WARNING]: errors were encountered during the plugin load for junipernetworks.junos.junos_vrf: ["'NoneType' object has no attribute 'get'"]
ERROR! couldn't resolve module/action 'junipernetworks.junos.junos_vrf'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/ansible_modules_redirection_test5/ansible-junos-stdlib/tests/junipernetworks.junos/pb.juniper_junos_vrf.yml': line 25, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


    - name: Deactivate VRF test-1
      ^ here
❌ pb.juniper_junos_vrf.yml failed with status 4
-----------------------------------------------------
All playbooks processed.
Passed test results saved to junos_passed_tests.log

root@masterhost:~/ansible_modules_redirection_test5/ansible-junos-stdlib/tests/junipernetworks.junos# cat junos_passed_tests.log 
pb.juniper_junos_acls.yml PASSED at Thu 08 May 2025 07:26:36 AM PDT
pb.juniper_junos_banner.yml PASSED at Thu 08 May 2025 07:26:37 AM PDT
pb.juniper_junos_bgp_address_family.yml PASSED at Thu 08 May 2025 07:26:37 AM PDT
pb.juniper_junos_bgp_global.yml PASSED at Thu 08 May 2025 07:26:38 AM PDT
pb.juniper_junos_command.yml PASSED at Thu 08 May 2025 07:26:39 AM PDT
pb.juniper_junos_config.yml PASSED at Thu 08 May 2025 07:26:40 AM PDT
pb.juniper_junos_facts.yml PASSED at Thu 08 May 2025 07:26:41 AM PDT
pb.juniper_junos_hostname.yml PASSED at Thu 08 May 2025 07:26:42 AM PDT
pb.juniper_junos_interfaces.yml PASSED at Thu 08 May 2025 07:26:42 AM PDT
pb.juniper_junos_l3_interfaces.yml PASSED at Thu 08 May 2025 07:26:44 AM PDT

Thanks
Chidanand

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.

2 participants