Skip to content

Commit

Permalink
Add molecule test to ovn_bgp_agent component
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Royo committed Nov 3, 2023
1 parent ebe1621 commit 00349d2
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/molecule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- edpm_nftables
- edpm_nodes_validation
- edpm_ovn
- edpm_ovn_bgp_agent
- edpm_sshd
- edpm_ssh_known_hosts
- edpm_timezone
Expand Down
4 changes: 4 additions & 0 deletions roles/edpm_ovn_bgp_agent/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
tasks_from: "download_cache.yml"
- ansible.builtin.include_role:
name: "osp.edpm.edpm_ovn_bgp_agent"
roles:
- role: "edpm_ovn_bgp_agent"
vars:
edpm_ovn_bgp_agent_config_src: "{{lookup('env', 'MOLECULE_SCENARIO_DIRECTORY')}}/test-data"
50 changes: 50 additions & 0 deletions roles/edpm_ovn_bgp_agent/molecule/default/molecule copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
- name: Verify ovn_bgp_agent
gather_facts: false
hosts: compute-1
vars:
test_helper_dir: "../../../../molecule/test-helpers"
tasks:
- name: ensure expected directories exist
ansible.builtin.include_tasks: "{{test_helper_dir}}/verify_dir.yaml"
loop:
- "/var/lib/config-data/ansible-generated/ovn-bgp-agent/etc/ovn-bgp-agent/bgp-agent.conf"
- "/var/log/containers/ovn-bgp-agent"
- "/var/lib/edpm-config/container-startup-config/ovn_bgp_agent"

- name: ensure systemd services are defined and functional
ansible.builtin.include_tasks: "{{test_helper_dir}}/verify_systemd_unit.yaml"
loop:
- {"name": "edpm_ovn_bgp_agent.service"}

- name: ensure podman container exists and are running
ansible.builtin.include_tasks: "{{test_helper_dir}}/verify_podman.yaml"
loop:
- "ovn_bgp_agent"

- name: ensure that log file for ovn_bgp_agent exist
become: true
block:
- name: Check if file /var/log/containers/stdouts/ovn_bgp_agent.log exist
ansible.builtin.stat:
path: /var/log/containers/stdouts/ovn_bgp_agent.log
register: log_file
- name: Assert file /var/log/containers/stdouts/ovn_bgp_agent.log exist
ansible.builtin.assert:
that:
- log_file.stat.exists
fail_msg: "File /vvar/log/containers/stdouts/ovn_bgp_agent.log does not exist"

- name: Ensure that 10-ovn_bgp_agent.conf was copied into the container
block:
- name: ovn_bgp_agent config file exists
become: true
ansible.builtin.stat:
path: "/var/lib/config-data/ansible-generated/ovn-bgp-agent/etc/ovn-bgp-agent/10-ovn-bgp-agent.conf"
register: ovn_bgp_agent_config

- name: assert that the config exists
ansible.builtin.assert:
that:
- ovn_bgp_agent_config.stat.exists
fail_msg: "ovn_bgp_agent config file does not exist"
1 change: 1 addition & 0 deletions roles/edpm_ovn_bgp_agent/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ scenario:
- create
- prepare
- converge
- verify
- destroy
verifier:
name: ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[DEFAULT]
debug=True
reconcile_interval=300
expose_tenant_networks=True
expose_ipv6_gua_tenant_networks=False
driver=ovn_bgp_driver
bgp_AS=64999
bgp_nic=bgp-nic
bgp_vrf=bgp-vrf
bgp_vrf_table_id=10
ovsdb_connection=tcp:127.0.0.1:6640

[agent]
root_helper=sudo ovn-bgp-agent-rootwrap /etc/ovn-bgp-agent/rootwrap.conf
root_helper_daemon=sudo ovn-bgp-agent-rootwrap-daemon /etc/ovn-bgp-agent/rootwrap.conf
1 change: 1 addition & 0 deletions roles/edpm_ovn_bgp_agent/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# under the License.

- name: Create persistent directories
become: true
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
Expand Down

0 comments on commit 00349d2

Please sign in to comment.