add long-running-job-test.yml; tasks/long_running_tasks.yml; and dev testing scripts

This commit is contained in:
Chris Hammer
2022-04-13 13:15:07 -04:00
parent 1285a96b2b
commit 44be415dca
4 changed files with 76 additions and 9 deletions

View File

@ -6,16 +6,19 @@
vars:
time_to_sleep : 300
run_cmd : "find /"
pause_time : 60
num_retries : 1440
poll_interval : 3
check_commands:
- uname -a
- uptime
- ping -c 1 127.0.0.1
tasks:
- name: Simulate a long running job
command : "{{ run_cmd }}"
async : "{{ time_to_sleep + 10 }}" # give +10s leeway
poll : "{{ poll_interval }}"
- name: Include long_running_tasks.yml
include_tasks: tasks/long_running_tasks.yml
...

View File

@ -0,0 +1,40 @@
---
- name: Run a series of test commands
command : "{{ item }}"
until : t_cmd.rc == 0
retries : "{{ num_retries }}"
delay : "{{ poll_interval }}"
loop : "{{ check_commands }}"
register : t_cmd
- name: Increment counter
set_fact:
rcount: "{{ 1 if rcount is undefined else rcount | int + 1 }}"
- name: End condition met. Aborting...
fail:
msg: "Bye"
when: rcount|int >= num_retries
- name: Current status
debug:
msg: "Currently on run {{ rcount }} of {{ num_retries }}."
run_once: yes
- name: Pause for {{ pause_time }} seconds
pause:
seconds: "{{ pause_time }}"
- name: Include ourself for recursion
include_tasks: tasks/long_running_tasks.yml
...

View File

@ -1,9 +1,9 @@
#!/bin/bash
CONC="50"
REQU="100"
CONC="5"
REQU="50"
BASE_URL="10.1.1.51"
BASE_URL="10.1.1.98"
AAP_JOB_ID="10"
POST_PAYLOAD_PATH="empty.post"
#POST_PAYLOAD_PATH="provision.post"

24
utils/dev_tower_test_2.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
CONC="50"
REQU="50"
BASE_URL="10.1.1.98"
AAP_JOB_ID="12"
POST_PAYLOAD_PATH="empty.post"
#POST_PAYLOAD_PATH="provision.post"
POST_PAYLOAD_TYPE="application/json"
TOWER_USER="admin"
TOWER_PASS="redhat"
printf "\n%s\n" \
"# Running test - ${REQU} requests / ${CONC} concurrency"
ab -c "${CONC}" \
-n ${REQU} \
-A ${TOWER_USER}:${TOWER_PASS} \
-T "${POST_PAYLOAD_TYPE}" \
-v1 \
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/job_templates/${AAP_JOB_ID}/launch/" | \
grep "Failed requests\|Time taken for tests"