-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6769 from inverse-inc/test/inlinel3
Test suites for inlinel2 and inlinel3
- Loading branch information
Showing
44 changed files
with
2,366 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- hosts: pfservers | ||
name: configure Packetfence VM | ||
become: True | ||
|
||
tasks: | ||
- name: Install qemu-system-x86 on debian | ||
apt: | ||
name: qemu-system-x86 | ||
state: present | ||
when: ansible_facts['os_family'] == "Debian" | ||
|
||
- name: Install qemu-kvm on el8 | ||
yum: | ||
name: qemu-kvm | ||
state: present | ||
enablerepo: "epel" | ||
when: ansible_facts['os_family'] == "RedHat" | ||
|
||
- name: For RHEL8Create a symbolic link for qemu-system-x86_64 | ||
ansible.builtin.file: | ||
src: /usr/libexec/qemu-kvm | ||
dest: /usr/bin/qemu-system-x86_64 | ||
state: link | ||
when: ansible_facts['os_family'] == "RedHat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- hosts: pfservers, service_venom, nodes | ||
name: Rsync Git repository t/venom with /usr/local/pf/t/venom (localdev only) | ||
become: True | ||
|
||
tasks: | ||
- name: Synchronize Git repository t/venom with /usr/local/pf/t/venom | ||
ansible.posix.synchronize: | ||
# src is provided through test-wrapper.sh | ||
# as $PWD/venom (no leading slash) | ||
src: "{{ lookup('env', 'VENOM_ROOT_DIR') }}" | ||
dest: '/usr/local/pf/t/' | ||
archive: yes | ||
delete: yes | ||
# exclude files dynamically generated by Ansible | ||
rsync_opts: | ||
- "--exclude=vars/local.yml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
- hosts: pfservers | ||
name: Run example tests | ||
become: True | ||
|
||
vars: | ||
# put your test suites to try here | ||
test_suites: | ||
- configurator_inline | ||
- inline/l3 | ||
- inline/l3/teardown | ||
- inline/l2 | ||
- inline/l2/teardown | ||
|
||
tasks: | ||
- name: Run Venom testsuites | ||
command: '{{ venom_dir }}/venom-wrapper.sh {{ venom_dir }}/test_suites/{{ item }}' | ||
args: | ||
chdir: '{{ venom_dir }}' | ||
loop: '{{ test_suites }}' | ||
vars: | ||
venom_wrapper_args: | ||
# temp, overcome two Venom issues: | ||
# - tap: https://github.com/ovh/venom/issues/428 | ||
# - when running test suite one by one, previous logs and results are overriden | ||
# Venom will create one directory per test suite to store results | ||
VENOM_COMMON_FLAGS: '--format=tap --output-dir={{ venom_dir }}/results/{{ item }}' | ||
|
||
# add inventory__group_environment to Ansible environment | ||
# useful to make env vars available for Venom | ||
environment: '{{ inventory__group_environment | d({}) | ||
| combine(venom_wrapper_args | d({})) }}' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# - import_playbook: playbooks/provision.yml | ||
|
||
# rsync before tests when doing local development | ||
- import_playbook: playbooks/rsync.yml | ||
when: lookup("env", "CI") != 'true' | ||
|
||
- import_playbook: playbooks/configure.yml | ||
|
||
- import_playbook: playbooks/run_tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
t/venom/test_suites/configurator_inline/00_configure_dhcp_listener_interface.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Configure DHCP listener interface | ||
testcases: | ||
# get_name_of: one-liner to get name (ex: eth0) based on index (ex: 1, 2) | ||
- name: get_name_of_dhcp_listener_int | ||
steps: | ||
- type: exec | ||
script: "ip -o link show | egrep -v '^1:' | grep '^{{.configurator.interfaces.dhcp_listener.index}}' | awk -F ': ' '{print $2;}'" | ||
vars: | ||
dhcp_listener_interface: | ||
from: result.systemout | ||
|
||
- name: configure_dhcp_listener_int | ||
steps: | ||
- type: http | ||
method: PATCH | ||
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}' | ||
ignore_verify_ssl: true | ||
body: >- | ||
{ | ||
"ipaddress": "{{.configurator.interfaces.dhcp_listener.ip}}", | ||
"netmask": "{{.configurator.interfaces.dhcp_listener.netmask}}", | ||
"type": "dhcp-listener" | ||
} | ||
headers: | ||
"Content-Type": "application/json" | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
|
||
# switch interface to static state | ||
- name: bounce_dhcp_listener_int | ||
steps: | ||
- type: http | ||
method: POST | ||
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}/down' | ||
ignore_verify_ssl: true | ||
headers: | ||
"Content-Type": "application/json" | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
- result.bodyjson.message ShouldEqual "Interface {{.get_name_of_dhcp_listener_int.dhcp_listener_interface}} disabled" | ||
|
||
- type: http | ||
method: POST | ||
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}/up' | ||
ignore_verify_ssl: true | ||
headers: | ||
"Content-Type": "application/json" | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
- result.bodyjson.message ShouldEqual "Interface {{.get_name_of_dhcp_listener_int.dhcp_listener_interface}} enabled" | ||
|
||
# start dhclient without any action on /etc/resolv.conf | ||
- name: start_dhclient_on_dhcp_listener_int | ||
steps: | ||
- type: exec | ||
script: "echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks" | ||
|
||
- type: exec | ||
script: "/usr/sbin/dhclient -nw {{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}" | ||
|
||
|
44 changes: 44 additions & 0 deletions
44
t/venom/test_suites/configurator_inline/10_run_configurator_step1.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Run configurator step 1 | ||
testcases: | ||
# get_name_of: one-liner to get name (ex: eth0) based on index (ex: 1, 2) | ||
- name: get_name_of_mgmt_int | ||
steps: | ||
- type: exec | ||
script: "ip -o link show | egrep -v '^1:' | grep '^{{.configurator.interfaces.mgmt.index}}' | awk -F ': ' '{print $2;}'" | ||
vars: | ||
mgmt_interface: | ||
from: result.systemout | ||
|
||
- name: configure_mgmt_int | ||
steps: | ||
- type: http | ||
method: PATCH | ||
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_mgmt_int.mgmt_interface}}' | ||
ignore_verify_ssl: true | ||
body: >- | ||
{ | ||
"ipaddress": "{{.configurator.interfaces.mgmt.ip}}", | ||
"netmask": "{{.configurator.interfaces.mgmt.netmask}}", | ||
"type": "management", | ||
"additional_listening_daemons": ["portal"] | ||
} | ||
headers: | ||
"Content-Type": "application/json" | ||
assertions: | ||
- result.statuscode ShouldEqual 200 | ||
|
||
|
||
- name: configure_dns_servers | ||
steps: | ||
- type: http | ||
method: PUT | ||
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/system/dns_servers' | ||
ignore_verify_ssl: true | ||
body: >- | ||
{ | ||
"dns_servers": ["{{.configurator.dns.primary_ip}}", "{{.configurator.dns.secondary_ip}}"] | ||
} | ||
headers: | ||
"Content-Type": "application/json" | ||
assertions: | ||
- result.statuscode ShouldEqual 200 |
Oops, something went wrong.