diff --git a/knot.spec b/knot.spec index a72d279..157e6ec 100644 --- a/knot.spec +++ b/knot.spec @@ -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) diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..c52e8a5 --- /dev/null +++ b/tests/README.md @@ -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 diff --git a/tests/test_basic_zone.yml b/tests/test_basic_zone.yml new file mode 100644 index 0000000..0f75c94 --- /dev/null +++ b/tests/test_basic_zone.yml @@ -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 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..b86e45f --- /dev/null +++ b/tests/tests.yml @@ -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