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

Feature/venom 1.0.0 #6775

Merged
merged 31 commits into from
Dec 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c6dc415
[Venom] Change Venom version to 1.0.0
JeGoi Dec 9, 2021
e89555d
Add test for multi executor
JeGoi Dec 14, 2021
7b4901c
[Venom] Add initial override
JeGoi Dec 14, 2021
251f19c
[Venom] Fix issue with customB
JeGoi Dec 14, 2021
7805d72
[Venom] Fix issue with customB A and the testcases
JeGoi Dec 14, 2021
b9e2e3d
[Venom] add executor in executor for delete_node
JeGoi Dec 14, 2021
44aff17
[Venom] Add delete with executors in executors
JeGoi Dec 14, 2021
b3051d0
[Venom] Add node cleanup as executors
JeGoi Dec 14, 2021
5119809
[Venom] Add test_venom and customD example
JeGoi Dec 16, 2021
fb57ad6
[Venom] v1.0.0 Add executors
JeGoi Dec 17, 2021
1744197
[Venom] Upgrade Venom version
JeGoi Dec 20, 2021
921df5b
[Venom] Test how to share value between results
JeGoi Dec 21, 2021
00a7da4
[Venom] tests on extrating var from multiple tests
JeGoi Dec 21, 2021
ffc6db0
[Venom] Test multisuite: extract from suite
JeGoi Dec 21, 2021
2e74298
[Venom] export data from multisteps
JeGoi Dec 21, 2021
1dcd51a
[Venom] add test to extract var from multisteps example with venom
JeGoi Dec 22, 2021
5e95630
[Venom] Add failling test to extract data from multisteps
JeGoi Dec 22, 2021
425810a
[Venom] Change venom version on install script
JeGoi Dec 22, 2021
8647fbf
Update t/venom/lib/customC.yml
JeGoi Dec 22, 2021
dfa2f40
remove tap workaround
nqb Dec 22, 2021
3b5eaf7
sort test suites when argument is a directory
nqb Dec 22, 2021
c6f9de9
Update t/venom/test_suites/test_venom/20_testVenom.yml
nqb Dec 22, 2021
a9c236c
adjust Venom tests
nqb Dec 22, 2021
45e11d9
remove useless '.json' in variable
nqb Dec 22, 2021
549a9bc
[Venom] Add absolute paths
JeGoi Dec 22, 2021
ae9b1c0
[Venom] fix issue with testing internet access from node1
JeGoi Dec 22, 2021
e3edfe9
[Venom] Fix issue when restart unit with test only
JeGoi Dec 22, 2021
ff0c71e
[Venom] Add sleeping time after restart from API
JeGoi Dec 22, 2021
a35a415
use syntax compatible with EL8 and Debian 11
nqb Dec 22, 2021
6524a29
[Venom] Revert modification for run_tests
JeGoi Dec 22, 2021
774fb22
enforce default role values when role is not part of the play
nqb Dec 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
packetfence_install__centos_release_rpm: "http://packetfence.org/downloads/PacketFence/RHEL8/packetfence-release-{{ pf_minor_release }}.el8.noarch.rpm"

# in localdev environment: we install from official repositories
packetfence_install__centos:
repos:
- packetfence

# override to installed test files
packetfence_install__centos_packages:
- packetfence
Expand Down
2 changes: 1 addition & 1 deletion addons/vagrant/inventory/group_vars/pfservers/venom.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
venom__version: 'v1.0.0-rc.7'
venom__version: 'v1.0.1'

venom_dir: '/usr/local/pf/t/venom'
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
venom__version: 'v1.0.0-rc.7'
venom__version: 'v1.0.1'

venom_dir: '/usr/local/pf/t/venom'

2 changes: 1 addition & 1 deletion addons/vagrant/playbooks/nodes/pre_prov/venom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- inverse_inc.utils

vars:
venom__version: 'v1.0.0-rc.7'
venom__version: 'v1.0.1'

roles:
- role: venom
Expand Down
2 changes: 1 addition & 1 deletion t/venom/.venomrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ variables_files:
- vars/all.yml
- vars/local.yml
stop_on_failure: true
#format: tap
format: tap
output_dir: results
lib_dir: lib
verbosity: 1
5 changes: 5 additions & 0 deletions t/venom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,8 @@ example_deb11:
SCENARIOS_TO_RUN=example \
$(MAKE_TARGET)

test_deb11:
make \
PF_VM_NAME=pfdeb11$(DEV_ENV) \
SCENARIOS_TO_RUN=test_venom\
$(MAKE_TARGET)
2 changes: 1 addition & 1 deletion t/venom/install-venom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VENOM_BIN_PATH=/usr/bin
VENOM_BINARY=venom
ROOTUSER_NAME=root
VENOM_LATEST_URL=https://api.github.com/repos/ovh/venom/releases/latest
VENOM_DEFAULT_VERSION="1.0.0-rc.7"
VENOM_DEFAULT_VERSION="1.0.1"
VENOM_INSTALL_VERSION=${VENOM_VERSION:-${VENOM_DEFAULT_VERSION}}
VENOM_LATEST_VERSION=""
VENOM_INSTALLED_VERSION=""
Expand Down
12 changes: 12 additions & 0 deletions t/venom/lib/check_host_internet_access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
executor: check_host_internet_access
# By default it will use the node1
input:
host: "{{.node01_mgmt_ip}}"
user: "{{.ssh_user}}"
steps:
- type: ssh
host: '{{.input.host}}'
user: '{{.input.user}}'
command: |
cd '{{.venom_dir}}' ; \
sudo '{{.venom_dir}}/venom-wrapper.sh' '{{.test_suites_dir}}/common/check_internet_access.yml'
12 changes: 12 additions & 0 deletions t/venom/lib/check_internet_access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
executor: check_internet_access
input:
url: '{{.network_detection_url}}'
steps:
- type: http
method: GET
url: '{{.input.url}}'
assertions:
- result.statuscode ShouldEqual 200
# retry to let node get IP by DHCP
retry: 6
delay: 10
15 changes: 15 additions & 0 deletions t/venom/lib/customA.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
executor: customA
input:
myArg: "world2"
steps:
- type: customB
myWord: "{{.input.myArg}}"
vars:
content:
from: result.foobarb
JeGoi marked this conversation as resolved.
Show resolved Hide resolved
- script: echo "hello {{.content}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldContainSubstring "{{.input.myArg}}"
output:
foobarA: "{{.result.systemout}}"
10 changes: 10 additions & 0 deletions t/venom/lib/customB.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
executor: customB
input:
myWord: "world"
steps:
- script: echo "{{.input.myWord}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldContainSubstring "{{.input.myWord}}"
output:
foobarB: "{{.result.systemout}}"
14 changes: 14 additions & 0 deletions t/venom/lib/customC.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
executor: customC
input:
myarg: {
"name": "default",
"surname": "default2"
}
steps:
- script: echo "{{.input.myarg.name}}" > t.log
- script: echo "{\"hello\":\"{{.input.myarg.name}} and {{.input.myarg.surname}}\"}"
assertions:
- result.code ShouldEqual 0
output:
systemout: "{{.result.systemout}}"
systemoutjson.hello: "{{.result.systemoutjson.hello}}"
12 changes: 12 additions & 0 deletions t/venom/lib/customD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
executor: customD
input:
myArg: "world2"
steps:
- type: customB
myWord: "{{.input.myArg}}"
- script: echo "hello {{.result.foobarb}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldContainSubstring "{{.input.myArg}}"
output:
foobard: "{{.result.systemout}}"
20 changes: 20 additions & 0 deletions t/venom/lib/customE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
executor: customE
input:
myArg: "world2"
steps:
- type: customB
myWord: "{{.input.myArg}}"
vars:
varCustomB:
from: result.foobarb
- script: echo "hello {{.varCustomB}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldContainSubstring "{{.input.myArg}}"
- script: echo "hello you {{.varCustomB}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldContainSubstring "{{.input.myArg}}"
output:
foobarb: "{{.varcustomb}}"
foobare: "{{.result.systemout}}"
10 changes: 7 additions & 3 deletions t/venom/lib/delete_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ executor: delete_node
input:
mac_address: {}
mac_address_url_encoded: {}
token: {}
steps:
# Get token
- type: get_login_token
vars:
token:
from: result.token
# delete_node
- type: http
method: DELETE
url: '{{.pfserver_webadmin_url}}/api/v1/node/{{.input.mac_address_url_encoded}}'
ignore_verify_ssl: true
headers:
"Authorization": "{{.input.token}}"
"Authorization": "{{.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
Expand All @@ -22,7 +26,7 @@ steps:
url: '{{.pfserver_webadmin_url}}/api/v1/node/{{.input.mac_address_url_encoded}}'
ignore_verify_ssl: true
headers:
"Authorization": "{{.input.token}}"
"Authorization": "{{.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 404
Expand Down
11 changes: 11 additions & 0 deletions t/venom/lib/foobarcustommultisteps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
executor: foobarcustommultisteps
input: {}
steps:
- script: echo "hello"
vars:
content:
from: result.systemout
- script: echo "{{.content}} world"
output:
foobar: "{{.result.systemout}}"
contento: "{{.content}}"
7 changes: 7 additions & 0 deletions t/venom/lib/haproxy_admin_restart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
executor: haproxy-admin_restart
input:
myarg: {}
steps:
# service restarted by hand because using API cause Venom failure (EOF)
- type: restart_systemctl_service
service: packetfence-haproxy-admin
19 changes: 19 additions & 0 deletions t/venom/lib/haproxy_admin_restart_api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
executor: haproxy-admini_restart_api
input:
myArg: {}
# service restarted by hand because using API cause Venom failure (EOF)
steps:
- type: get_login_token

- type: http
method: POST
url: '{{.pfserver_webadmin_url}}/api/v1/service/haproxy-admin/restart'
ignore_verify_ssl: true
headers:
"Authorization": "{{.result.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200

- type: sleep
time_to_sleep: 5
33 changes: 33 additions & 0 deletions t/venom/lib/node_delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
executor: delete_node
input:
mac_address: {}
mac_address_url_encoded: {}
steps:
# Get token
- type: get_login_token
vars:
token:
from: result.token
# delete_node
- type: http
method: DELETE
url: '{{.pfserver_webadmin_url}}/api/v1/node/{{.input.mac_address_url_encoded}}'
ignore_verify_ssl: true
headers:
"Authorization": "{{.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.message ShouldEqual "Deleted {{.input.mac_address}} successfully"

# check node deleted
- type: http
method: GET
url: '{{.pfserver_webadmin_url}}/api/v1/node/{{.input.mac_address_url_encoded}}'
ignore_verify_ssl: true
headers:
"Authorization": "{{.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 404
- result.bodyjson.message ShouldEqual "Unable to get resource with this identifier"
5 changes: 5 additions & 0 deletions t/venom/lib/node_disable_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
executor: enable_node_cleanup

steps:
- type: node_task_cleanup
status: "disable"
5 changes: 5 additions & 0 deletions t/venom/lib/node_enable_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
executor: enable_node_cleanup

steps:
- type: node_task_cleanup
status: "enable"
42 changes: 42 additions & 0 deletions t/venom/lib/node_task_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
executor: node_task_cleanup
input:
status: "enabled"
interval: "{{.node_cleanup.delete_window.interval}}"
unit: "{{.node_cleanup.delete_window.unit}}"

steps:
- type: get_login_token
vars:
token:
from: result.token

- type: http
method: PATCH
url: '{{.pfserver_webadmin_url}}/api/v1/config/maintenance_task/node_cleanup'
ignore_verify_ssl: true
body: >-
{
"status": "{{.input.status}}"
}
headers:
"Authorization": "{{.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200

- type: http
method: PATCH
url: '{{.pfserver_webadmin_url}}/api/v1/config/maintenance_task/node_cleanup'
ignore_verify_ssl: true
body: >-
{
"delete_window": {
"interval": "{{.input.interval}}",
"unit": "{{.input.unit}}"
}
}
headers:
"Authorization": "{{.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
21 changes: 21 additions & 0 deletions t/venom/lib/pf_api_service_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
executor: pf_api_service_action
input:
service: {}
action: {}
steps:
- type: get_login_token

- type: http
method: POST
url: '{{.pfserver_webadmin_url}}/api/v1/service/{{.input.service}}/{{.input.action}}'
ignore_verify_ssl: true
headers:
"Authorization": "{{.result.token}}"
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
output:
postjson: "{{.result.bodyjson}}"

- type: sleep
time_to_sleep: 5
10 changes: 10 additions & 0 deletions t/venom/lib/pf_api_service_disable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
executor: pf_api_service_disable
input:
service: {}
steps:
- type: pf_api_service_action
service: "{{.input.service}}"
action: "disable"

- type: sleep
time_to_sleep: 5
10 changes: 10 additions & 0 deletions t/venom/lib/pf_api_service_enable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
executor: pf_api_service_enable
input:
service: {}
steps:
- type: pf_api_service_action
service: "{{.input.service}}"
action: "enable"

- type: sleep
time_to_sleep: 5
10 changes: 10 additions & 0 deletions t/venom/lib/pf_api_service_restart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
executor: pf_api_service_restart
input:
service: {}
steps:
- type: pf_api_service_action
service: "{{.input.service}}"
action: "restart"

- type: sleep
time_to_sleep: 5
10 changes: 10 additions & 0 deletions t/venom/lib/pf_api_service_start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
executor: pf_api_service_start
input:
service: {}
steps:
- type: pf_api_service_action
service: "{{.input.service}}"
action: "start"

- type: sleep
time_to_sleep: 5
9 changes: 9 additions & 0 deletions t/venom/lib/pf_api_service_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
executor: pf_api_service_status
input:
service: {}
steps:
- type: pf_api_service_action
service: "{{.input.service}}"
action: "status"
output:
postjson: "{{.result.postjson}}"
Loading