Upgrade the Notarius role to version 0.7.0
This commit is contained in:
@@ -11,15 +11,17 @@ export ANSIBLE_ROLES_PATH="$(dirname "$repository_root")"
|
||||
|
||||
inventory="$repository_root/tests/inventory"
|
||||
converge="$repository_root/tests/converge.yml"
|
||||
verify_config="$repository_root/tests/verify-config.yml"
|
||||
prepare_import="$repository_root/tests/prepare-import.yml"
|
||||
ansible_playbook="$workspace_venv/bin/ansible-playbook"
|
||||
binary_path=/usr/local/bin/notarius
|
||||
config_path=/usr/local/etc/notarius/config.yml
|
||||
imported_pipeline_path=/usr/local/etc/notarius/test-pipelines.yml
|
||||
|
||||
cleanup() {
|
||||
exit_status=$?
|
||||
trap - EXIT
|
||||
"$ansible_playbook" -i "$inventory" "$converge" >/dev/null 2>&1 || true
|
||||
sudo rm -f -- "$imported_pipeline_path"
|
||||
rm -rf -- "$test_tmp"
|
||||
exit "$exit_status"
|
||||
}
|
||||
@@ -44,7 +46,7 @@ cd "$repository_root"
|
||||
-r collections/requirements.yml \
|
||||
-p "$ANSIBLE_COLLECTIONS_PATH"
|
||||
"$ansible_playbook" -i "$inventory" --syntax-check "$converge"
|
||||
"$workspace_venv/bin/ansible-lint" "$converge" "$verify_config"
|
||||
"$workspace_venv/bin/ansible-lint" "$converge" "$prepare_import"
|
||||
|
||||
baseline_log="$test_tmp/baseline.log"
|
||||
run_converge "$baseline_log"
|
||||
@@ -55,8 +57,8 @@ run_converge "$baseline_repeat_log"
|
||||
require_clean_recap "$baseline_repeat_log"
|
||||
|
||||
selected_release_log="$test_tmp/selected-release.log"
|
||||
run_converge "$selected_release_log" -e notarius_version=v0.5.0
|
||||
[[ "$("$binary_path" --version)" == 'notarius v0.5.0' ]]
|
||||
run_converge "$selected_release_log" -e notarius_version=v0.7.0
|
||||
[[ "$("$binary_path" --version)" == 'notarius v0.7.0' ]]
|
||||
|
||||
custom_go_binary="$test_tmp/go"
|
||||
custom_go_invocations="$test_tmp/go-invocations.log"
|
||||
@@ -69,24 +71,32 @@ chmod 0755 "$custom_go_binary"
|
||||
sudo rm -f -- "$binary_path"
|
||||
recovery_log="$test_tmp/recovery.log"
|
||||
run_converge "$recovery_log" \
|
||||
-e notarius_version=v0.5.0 \
|
||||
-e notarius_version=v0.7.0 \
|
||||
-e '{"notarius_manage_build_dependencies": false}' \
|
||||
-e "notarius_go_binary=$custom_go_binary"
|
||||
grep -q . "$custom_go_invocations"
|
||||
[[ "$("$binary_path" --version)" == 'notarius v0.5.0' ]]
|
||||
[[ "$("$binary_path" --version)" == 'notarius v0.7.0' ]]
|
||||
recovery_repeat_log="$test_tmp/recovery-repeat.log"
|
||||
run_converge "$recovery_repeat_log" \
|
||||
-e notarius_version=v0.5.0 \
|
||||
-e notarius_version=v0.7.0 \
|
||||
-e '{"notarius_manage_build_dependencies": false}' \
|
||||
-e "notarius_go_binary=$custom_go_binary"
|
||||
require_clean_recap "$recovery_repeat_log"
|
||||
|
||||
pipeline_group_one='{"dnd-session":{"llm_profile":"dnd-extraction","input":"seriatim","artifacts":{"spells":{"extract":"dnd/spells","normalize":"dnd/spells"}}}}'
|
||||
pipeline_group_two='{"dnd-archive":{"llm_profile":"dnd-extraction","input":"seriatim","artifacts":{"spells":{"extract":"dnd/spells","normalize":"dnd/spells"}}}}'
|
||||
representative_config="{\"notarius_pipeline_group_one\":$pipeline_group_one,\"notarius_pipeline_group_two\":$pipeline_group_two,\"notarius_pipelines\":\"{{ notarius_pipeline_group_one | combine(notarius_pipeline_group_two) }}\",\"notarius_config_version\":4,\"notarius_promptkit_local_backend_endpoint\":\"http://localhost:8000/v1\",\"notarius_promptkit_local_backend_concurrency_limit\":0,\"notarius_cache_checkpoints_enabled\":false,\"notarius_cache_chunk_plans_directory\":\"\",\"notarius_output_directory\":\"/tmp/notarius-output\",\"notarius_promptkit_profile_dir\":null,\"notarius_promptkit_profile_file\":null,\"notarius_debug_directory\":null}"
|
||||
pipeline_group_one='{"dnd-session":{"llm_profile":"dnd-extraction","input":{"module":"seriatim"},"artifacts":{"spells":{"extract":{"module":"dnd/spells"},"normalize":{"module":"dnd/spells"}}}}}'
|
||||
pipeline_group_two='{"dnd-archive":{"llm_profile":"dnd-extraction","input":{"module":"seriatim"},"artifacts":{"spells":{"extract":{"module":"dnd/spells"},"normalize":{"module":"dnd/spells"}}}}}'
|
||||
representative_config="{\"notarius_pipeline_group_one\":$pipeline_group_one,\"notarius_pipeline_group_two\":$pipeline_group_two,\"notarius_configkit_imports\":[{\"path\":\"test-pipelines.yml\"}],\"notarius_promptkit_local_backend_endpoint\":\"http://localhost:8000/v1\",\"notarius_promptkit_local_backend_concurrency_limit\":0,\"notarius_cache_checkpoints_enabled\":false,\"notarius_cache_chunk_plans_mode\":\"bypass\",\"notarius_cache_chunk_plans_directory\":\"/tmp/notarius-cache/chunk-plans\",\"notarius_cache_checkpoints_directory\":\"/tmp/notarius-cache/checkpoints\",\"notarius_output_directory\":\"/tmp/notarius-output\",\"notarius_promptkit_profile_dir\":null,\"notarius_promptkit_profile_file\":null,\"notarius_debug_directory\":null}"
|
||||
"$ansible_playbook" -i "$inventory" "$prepare_import" -e "$representative_config"
|
||||
representative_log="$test_tmp/representative.log"
|
||||
run_converge "$representative_log" -e "$representative_config"
|
||||
"$ansible_playbook" -i "$inventory" "$verify_config"
|
||||
"$binary_path" config validate --config "$config_path" --pipeline dnd-session
|
||||
effective_config="$test_tmp/effective-config.yml"
|
||||
"$binary_path" config effective --config "$config_path" > "$effective_config"
|
||||
grep -Fq 'dnd-session:' "$effective_config"
|
||||
grep -Fq 'dnd-archive:' "$effective_config"
|
||||
grep -Fq 'mode: bypass' "$effective_config"
|
||||
grep -Fq 'enabled: false' "$effective_config"
|
||||
grep -Fq 'directory: /tmp/notarius-cache/chunk-plans' "$effective_config"
|
||||
representative_repeat_log="$test_tmp/representative-repeat.log"
|
||||
run_converge "$representative_repeat_log" -e "$representative_config"
|
||||
require_clean_recap "$representative_repeat_log"
|
||||
|
||||
13
tests/prepare-import.yml
Normal file
13
tests/prepare-import.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Prepare imported Notarius test configuration
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Write test-owned imported pipeline configuration
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
content: "{{ {'pipelines': notarius_pipeline_group_one | combine(notarius_pipeline_group_two)} | to_nice_yaml }}"
|
||||
dest: /usr/local/etc/notarius/test-pipelines.yml
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
- name: Verify rendered Notarius configuration
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Read rendered configuration
|
||||
become: true
|
||||
ansible.builtin.slurp:
|
||||
src: /usr/local/etc/notarius/config.yml
|
||||
register: notarius_rendered_config_file
|
||||
|
||||
- name: Check representative rendered configuration
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- notarius_rendered_config.version == 4
|
||||
- notarius_rendered_config.promptkit.local_backend.endpoint == "http://localhost:8000/v1"
|
||||
- notarius_rendered_config.promptkit.local_backend.concurrency_limit == 0
|
||||
- notarius_rendered_config.cache.checkpoints.enabled is false
|
||||
- notarius_rendered_config.cache.chunk_plans.directory == ""
|
||||
- notarius_rendered_config.output.directory == "/tmp/notarius-output"
|
||||
- notarius_rendered_config.pipelines["dnd-session"] == notarius_expected_pipeline
|
||||
- notarius_rendered_config.pipelines["dnd-archive"] == notarius_expected_pipeline
|
||||
- notarius_rendered_config.promptkit.profile_dir is not defined
|
||||
- notarius_rendered_config.promptkit.profile_file is not defined
|
||||
- notarius_rendered_config.debug is not defined
|
||||
vars:
|
||||
notarius_rendered_config: "{{ notarius_rendered_config_file.content | b64decode | from_yaml }}"
|
||||
notarius_expected_pipeline:
|
||||
llm_profile: dnd-extraction
|
||||
input: seriatim
|
||||
artifacts:
|
||||
spells:
|
||||
extract: dnd/spells
|
||||
normalize: dnd/spells
|
||||
|
||||
- name: Validate rendered configuration
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/local/bin/notarius
|
||||
- config
|
||||
- validate
|
||||
- --config
|
||||
- /usr/local/etc/notarius/config.yml
|
||||
changed_when: false
|
||||
Reference in New Issue
Block a user