diff --git a/tests/named.conf.options b/tests/named.conf.options new file mode 100644 index 0000000..2807f27 --- /dev/null +++ b/tests/named.conf.options @@ -0,0 +1,29 @@ +options { + directory "/var/cache/bind"; + + // If there is a firewall between you and nameservers you want + // to talk to, you may need to fix the firewall to allow multiple + // ports to talk. See http://www.kb.cert.org/vuls/id/800113 + + // If your ISP provided one or more IP addresses for stable + // nameservers, you probably want to use them as forwarders. + // Uncomment the following block, and insert the addresses replacing + // the all-0's placeholder. + + // forwarders { + // 0.0.0.0; + // }; + + //======================================================================== + // If BIND logs error messages about the root key being expired, + // you will need to update your keys. See https://www.isc.org/bind-keys + //======================================================================== + dnssec-validation auto; + + auth-nxdomain no; # conform to RFC1035 + listen-on-v6 { any; }; + allow-new-zones yes; + request-ixfr no; + recursion no; +}; + diff --git a/tests/pools.yaml.sample b/tests/pools.yaml.sample new file mode 100644 index 0000000..d942dc0 --- /dev/null +++ b/tests/pools.yaml.sample @@ -0,0 +1,44 @@ +- name: default + # The name is immutable. There will be no option to change the name after + # creation and the only way will to change it will be to delete it + # (and all zones associated with it) and recreate it. + description: Default BIND9 Pool + + attributes: {} + + # List out the NS records for zones hosted within this pool + ns_records: + - hostname: ns1-1.example.org. + priority: 1 + + # List out the nameservers for this pool. These are the actual BIND servers. + # We use these to verify changes have propagated to all nameservers. + nameservers: + - host: 127.0.0.1 + port: 53 + + # List out the targets for this pool. For BIND, most often, there will be one + # entry for each BIND server. + targets: + - type: bind9 + description: BIND9 Server 1 + + # List out the designate-mdns servers from which BIND servers should + # request zone transfers (AXFRs) from. + masters: + - host: 127.0.0.1 + port: 5354 + + # BIND Configuration options + options: + host: 127.0.0.1 + port: 53 + rndc_host: 127.0.0.1 + rndc_port: 953 + rndc_key_file: /etc/bind/rndc.key + + # Optional list of additional IP/Port's for which designate-mdns will send + # DNS NOTIFY packets to + # also_notifies: + # - host: 192.0.2.4 + # port: 53 diff --git a/tests/test-designate-functional.yml b/tests/test-designate-functional.yml new file mode 100644 index 0000000..9dfe1f8 --- /dev/null +++ b/tests/test-designate-functional.yml @@ -0,0 +1,38 @@ +--- +# Copyright 2015, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Playbook for functional testing of designate + hosts: designate_all[0] + user: root + gather_facts: false + tasks: + - name: Check the designate API + uri: + url: "http://localhost:9001" + status_code: 200 + - name: Create test domain + shell: | + . /root/openrc + {{ designate_venv_bin }}/designate domain-create --name designate-example.com. --email designate@example.org + - name: Verify domain gets created + shell: | + . /root/openrc + {{ designate_venv_bin }}/designate domain-get designate-example.com. + register: domain_status + until: domain_status|success + retries: 5 + delay: 5 + vars_files: + - test-vars.yml diff --git a/tests/test-install-designate.yml b/tests/test-install-designate.yml index d0c979f..b3e8637 100644 --- a/tests/test-install-designate.yml +++ b/tests/test-install-designate.yml @@ -81,7 +81,35 @@ - "localhost" - "%" delegate_to: "10.100.100.101" + - name: Install bind9 + apt: + package: bind9 + state: present + - name: Drop bind configuration + copy: + src: named.conf.options + dest: /etc/bind/named.conf.options + - name: Restart bind9 + service: + name: bind9 + state: restarted roles: - role: "{{ rolename | basename }}" vars_files: - test-vars.yml + +- name: Import pools + hosts: designate_all[0] + user: root + gather_facts: true + tasks: + - name: Copy sample pools.yaml file + copy: + src: pools.yaml.sample + dest: /etc/designate/pools.yaml + - name: Import sample pools.yaml file + shell: | + . /root/openrc + {{ designate_venv_bin }}/designate-manage pool update --file /etc/designate/pools.yaml + vars_files: + - test-vars.yml diff --git a/tests/test-vars.yml b/tests/test-vars.yml index 414b2d4..6df9c9c 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -68,3 +68,4 @@ designate_pool_manager_container_mysql_password: "SuperSecrete" designate_rabbitmq_password: "secrete" designate_rabbitmq_userid: designate designate_rabbitmq_vhost: /designate +designate_venv_bin: "/openstack/venvs/designate-{{ designate_venv_tag }}/bin" diff --git a/tests/test.yml b/tests/test.yml index 4ef3be6..8e2c681 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -31,3 +31,6 @@ # Install Designate - include: test-install-designate.yml +# Test Designate +- include: test-designate-functional.yml + diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml index dc4d1fa..ec67736 100644 --- a/vars/ubuntu-14.04.yml +++ b/vars/ubuntu-14.04.yml @@ -16,5 +16,4 @@ cache_timeout: 600 # Common apt packages -designate_apt_packages: - - bind9 \ No newline at end of file +designate_apt_packages: []