Compose the D&D pipeline roles
This commit is contained in:
6
tests/converge.yml
Normal file
6
tests/converge.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Converge the D&D pipeline role
|
||||
hosts: localhost
|
||||
gather_facts: true
|
||||
roles:
|
||||
- role: ansible-role-dnd-pipeline
|
||||
63
tests/integration
Executable file
63
tests/integration
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repository_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
workspace_venv="$repository_root/../.venv"
|
||||
test_tmp=$(mktemp -d)
|
||||
chmod 0700 "$test_tmp"
|
||||
|
||||
export ANSIBLE_COLLECTIONS_PATH="$test_tmp/collections"
|
||||
export ANSIBLE_ROLES_PATH="$(dirname "$repository_root"):$test_tmp/roles"
|
||||
|
||||
inventory="$repository_root/tests/inventory"
|
||||
converge="$repository_root/tests/converge.yml"
|
||||
ansible_playbook="$workspace_venv/bin/ansible-playbook"
|
||||
baseline_args=(-e 'dnd_pipeline_whisperx_transcribe_url=http://127.0.0.1:8000/transcribe')
|
||||
profile_dir="$test_tmp/profiles"
|
||||
|
||||
cleanup() {
|
||||
exit_status=$?
|
||||
trap - EXIT
|
||||
"$ansible_playbook" -i "$inventory" "${baseline_args[@]}" "$converge" >/dev/null 2>&1 || true
|
||||
rm -rf -- "$test_tmp"
|
||||
exit "$exit_status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
require_clean_recap() {
|
||||
grep -Eq 'changed=0 .*failed=0' "$1"
|
||||
}
|
||||
|
||||
run_converge() {
|
||||
output_file=$1
|
||||
shift
|
||||
"$ansible_playbook" -i "$inventory" "$@" "$converge" | tee "$output_file"
|
||||
}
|
||||
|
||||
cd "$repository_root"
|
||||
mkdir -p "$profile_dir"
|
||||
printf '%s\n' \
|
||||
'id: endpoint-profile' \
|
||||
'endpoint: http://127.0.0.1:8000/v1' \
|
||||
'model: offline-fixture' > "$profile_dir/endpoint-profile.yml"
|
||||
"$workspace_venv/bin/ansible-galaxy" collection install \
|
||||
-r collections/requirements.yml \
|
||||
-p "$ANSIBLE_COLLECTIONS_PATH"
|
||||
"$workspace_venv/bin/ansible-galaxy" role install \
|
||||
-r requirements.yml \
|
||||
-p "$test_tmp/roles"
|
||||
"$ansible_playbook" -i "$inventory" --syntax-check "$converge"
|
||||
"$workspace_venv/bin/ansible-lint" --offline --profile production "$converge"
|
||||
|
||||
baseline_log="$test_tmp/baseline.log"
|
||||
run_converge "$baseline_log" "${baseline_args[@]}"
|
||||
/usr/local/bin/seriatim --version
|
||||
/usr/local/bin/audita config validate --config /usr/local/etc/audita/config.yml
|
||||
/usr/local/bin/notarius config validate --config /usr/local/etc/notarius/config.yml
|
||||
/usr/local/bin/scriptorium inspect profile --config /usr/local/etc/scriptorium/config.yml \
|
||||
--profile-dir "$profile_dir" --profile endpoint-profile
|
||||
/usr/bin/sudo -u narratio /usr/local/bin/narratio config validate \
|
||||
--config /usr/local/etc/narratio/pipeline.yml
|
||||
baseline_repeat_log="$test_tmp/baseline-repeat.log"
|
||||
run_converge "$baseline_repeat_log" "${baseline_args[@]}"
|
||||
require_clean_recap "$baseline_repeat_log"
|
||||
1
tests/inventory
Normal file
1
tests/inventory
Normal file
@@ -0,0 +1 @@
|
||||
localhost ansible_connection=local
|
||||
Reference in New Issue
Block a user