add integration test
This commit is contained in:
parent
671f04d0a2
commit
6156f9370a
@ -228,6 +228,8 @@ fi
|
||||
%changelog
|
||||
* Mon Jan 22 2018 Tomas Krizek <tomas.krizek@nic.cz> - 2.6.4-1
|
||||
- Added PGP signature verification
|
||||
- Added integration test
|
||||
|
||||
- New upstream release 2.6.4
|
||||
|
||||
Knot DNS 2.6.4 (2018-01-02)
|
||||
|
22
tests/README.md
Normal file
22
tests/README.md
Normal file
@ -0,0 +1,22 @@
|
||||
Package tests
|
||||
=============
|
||||
|
||||
These tests implement the standard test interface in Fedora CI.
|
||||
See https://fedoraproject.org/wiki/CI/Tests for details.
|
||||
|
||||
Manual execution
|
||||
----------------
|
||||
|
||||
Run the following command on your machine. Please note, it will make
|
||||
modifications to your system. It's best to run these on a clean, throw-away
|
||||
testing system or a VM.
|
||||
|
||||
ansible-playbook tests/tests.yml -e subjects=/path/to/knot.rpm,/path/to/knot-libs.rpm -e artifacts=/path/to/artifacts
|
||||
|
||||
Automatic execution
|
||||
-------------------
|
||||
|
||||
These tests should eventually be automatically executed by the Fedora CI
|
||||
pipeline. As of 2018-01-10, it is not supported for packages that aren't part
|
||||
of Fedora Atomic. Once it is implemented, the results of these tests should be
|
||||
visible in dist-git commits on src.fedoraproject.org
|
33
tests/test_basic_zone.yml
Normal file
33
tests/test_basic_zone.yml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
- block:
|
||||
- name: create zone file
|
||||
shell: cp /usr/share/doc/knot/samples/example.com.zone /var/lib/knot/example.com.zone
|
||||
|
||||
- name: configure knot to serve example.com zone
|
||||
lineinfile:
|
||||
path: /etc/knot/knot.conf
|
||||
regexp: '^#? - domain: example.com$'
|
||||
state: present
|
||||
line: ' - domain: example.com'
|
||||
|
||||
- name: start knot.service
|
||||
service:
|
||||
name: knot.service
|
||||
state: restarted
|
||||
|
||||
- name: check if query is answered
|
||||
shell: dig @127.0.0.1 example.com
|
||||
register: res
|
||||
failed_when: "'NOERROR' not in res.stdout"
|
||||
|
||||
- name: check query for non-existent zone is refused
|
||||
shell: dig @127.0.0.1 example2.com
|
||||
register: res
|
||||
failed_when: "'REFUSED' not in res.stdout"
|
||||
|
||||
rescue:
|
||||
- set_fact:
|
||||
test_basic_zone_failed: true
|
||||
always:
|
||||
- name: collect journal
|
||||
shell: journalctl --since -10m > {{ artifacts }}/test_basic_zone_journal.log
|
25
tests/tests.yml
Normal file
25
tests/tests.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
pre_tasks:
|
||||
- package: # Install additional dependecies
|
||||
name: bind-utils
|
||||
state: latest
|
||||
roles:
|
||||
- role: standard-test-rpm
|
||||
tags:
|
||||
- classic
|
||||
tasks:
|
||||
- include_tasks: test_basic_zone.yml
|
||||
|
||||
- set_fact:
|
||||
tests_passed: '{{ test_basic_zone_failed is undefined }}'
|
||||
- name: report results
|
||||
debug:
|
||||
msg: |
|
||||
test_basic_zone: {{ 'FAILED' if test_basic_zone_failed is defined else 'OK'}}
|
||||
|
||||
- name: fail playbook if tests failed
|
||||
debug:
|
||||
msg: --- {{ 'PASSED' if tests_passed else 'FAILED' }} ---
|
||||
failed_when: not tests_passed
|
Loading…
Reference in New Issue
Block a user