diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..5bf4685 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/charm-designate-bind.git diff --git a/Makefile b/Makefile deleted file mode 100644 index 417a556..0000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/make -LAYER_PATH := layers - -clean: - rm -Rf build - -generate: clean - LAYER_PATH=$(LAYER_PATH) tox -e generate diff --git a/README.md b/README.md new file mode 100644 index 0000000..fadc4f6 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# Overview + +This is a "source" charm, which is intended to be strictly the top +layer of a built charm. This structure declares that any included +layer assets are not intended to be consumed as a layer from a +functional or design standpoint. + +# Test and Build + +Building, pushing and publishing to the charm store is automated +by CI to ensure consistent flow. Manually building is useful for +development and testing, however. + +``` +tox -e pep8 +tox -e py34 # or py27 or py35 +tox -e build +``` + +# Contact Information + +Freenode IRC: #openstack-charms diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..02b5ef0 --- /dev/null +++ b/src/README.md @@ -0,0 +1 @@ +# Write me. diff --git a/src/metadata.yaml b/src/metadata.yaml index 0d7a561..9476a56 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -10,9 +10,9 @@ description: | Designate, providing DNSaaS in an OpenStack cloud. tags: - openstack + - dns series: - trusty - - wily - xenial subordinate: false provides: diff --git a/src/tests.yaml b/src/tests.yaml new file mode 100644 index 0000000..e3185c6 --- /dev/null +++ b/src/tests.yaml @@ -0,0 +1,17 @@ +# Bootstrap the model if necessary. +bootstrap: True +# Re-use bootstrap node instead of destroying/re-bootstrapping. +reset: True +# Use tox/requirements to drive the venv instead of bundletester's venv feature. +virtualenv: False +# Leave makefile empty, otherwise unit/lint tests will rerun ahead of amulet. +makefile: [] +# Do not specify juju PPA sources. Juju is presumed to be pre-installed +# and configured in all test runner environments. +#sources: +# Do not specify or rely on system packages. +#packages: +# Do not specify python packages here. Use test-requirements.txt +# and tox instead. ie. The venv is constructed before bundletester +# is invoked. +#python-packages: diff --git a/src/tests/README.md b/src/tests/README.md new file mode 100644 index 0000000..046be7f --- /dev/null +++ b/src/tests/README.md @@ -0,0 +1,9 @@ +# Overview + +This directory provides Amulet tests to verify basic deployment functionality +from the perspective of this charm, its requirements and its features, as +exercised in a subset of the full OpenStack deployment test bundle topology. + +For full details on functional testing of OpenStack charms please refer to +the [functional testing](http://docs.openstack.org/developer/charm-guide/testing.html#functional-testing) +section of the OpenStack Charm Guide. diff --git a/src/tests/basic_deployment.py b/src/tests/basic_deployment.py index d357d5c..294af28 100644 --- a/src/tests/basic_deployment.py +++ b/src/tests/basic_deployment.py @@ -40,7 +40,7 @@ class DesignateBindDeployment(amulet_deployment.OpenStackAmuletDeployment): def __init__(self, series, openstack=None, source=None, stable=False): """Deploy the entire test environment.""" super(DesignateBindDeployment, self).__init__(series, openstack, - source, stable) + source, stable) self._add_services() self._add_relations() self._configure_services() @@ -63,10 +63,9 @@ class DesignateBindDeployment(amulet_deployment.OpenStackAmuletDeployment): other_services = [{'name': 'mysql'}, {'name': 'rabbitmq-server'}, {'name': 'keystone'}, - {'name': 'designate', - 'location': 'cs:~gnuoy/trusty/designate-0'}] + {'name': 'designate'}] super(DesignateBindDeployment, self)._add_services(this_service, - other_services) + other_services) def _add_relations(self): """Add all of the relations for the services.""" diff --git a/src/tests/dev-basic-xenial-newton b/src/tests/dev-basic-xenial-newton new file mode 100755 index 0000000..0c38d47 --- /dev/null +++ b/src/tests/dev-basic-xenial-newton @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# +# Copyright 2016 Canonical Ltd +# +# 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. + +"""Amulet tests on a basic designate-bind deployment on xenial-newton.""" + +from basic_deployment import DesignateBindDeployment + +if __name__ == '__main__': + deployment = DesignateBindDeployment(series='xenial', + openstack='cloud:xenial-newton', + source='cloud:xenial-updates/newton') + deployment.run_tests() diff --git a/src/tests/gate-basic-trusty b/src/tests/dev-basic-yakkety-newton similarity index 83% rename from src/tests/gate-basic-trusty rename to src/tests/dev-basic-yakkety-newton index 064532c..3e9d186 100755 --- a/src/tests/gate-basic-trusty +++ b/src/tests/dev-basic-yakkety-newton @@ -1,5 +1,5 @@ #!/usr/bin/env python - +# # Copyright 2016 Canonical Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - -"""Amulet tests on a basic aodh deployment on trusty-mitaka.""" +"""Amulet tests on a basic designate-bind deployment on yakkety-newton.""" from basic_deployment import DesignateBindDeployment if __name__ == '__main__': - deployment = DesignateBindDeployment(series='trusty') + deployment = DesignateBindDeployment(series='yakkety') deployment.run_tests() diff --git a/src/tests/gate-basic-trusty-mitaka b/src/tests/gate-basic-trusty-mitaka new file mode 100755 index 0000000..69145cc --- /dev/null +++ b/src/tests/gate-basic-trusty-mitaka @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +# Copyright 2016 Canonical Ltd +# +# 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. + + +"""Amulet tests on a basic designate-bind deployment on trusty-mitaka.""" + +from basic_deployment import DesignateBindDeployment + +if __name__ == '__main__': + deployment = DesignateBindDeployment( + series='trusty', + openstack='cloud:trusty-mitaka', + source='cloud:trusty-updates/mitaka') + deployment.run_tests() diff --git a/src/tests/gate-basic-xenial b/src/tests/gate-basic-xenial-mitaka similarity index 91% rename from src/tests/gate-basic-xenial rename to src/tests/gate-basic-xenial-mitaka index 4764fa2..607afb8 100755 --- a/src/tests/gate-basic-xenial +++ b/src/tests/gate-basic-xenial-mitaka @@ -15,7 +15,7 @@ # limitations under the License. -"""Amulet tests on a basic aodh deployment on mitaka.""" +"""Amulet tests on a basic designate-bind deployment on mitaka.""" from basic_deployment import DesignateBindDeployment diff --git a/src/tox.ini b/src/tox.ini index 127dd33..4a6291e 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -7,6 +7,7 @@ envdir = .tox/py27 setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 AMULET_SETUP_TIMEOUT=2700 +passenv = HOME TERM AMULET_HTTP_PROXY AMULET_OS_VIP deps = -r{toxinidir}/test-requirements.txt install_command = pip install --allow-unverified python-apt {opts} {packages} diff --git a/test-requirements.txt b/test-requirements.txt index 41b4231..9a0bed8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,4 +4,4 @@ os-testr>=0.4.1 charms.reactive mock>=1.2 coverage>=3.6 -git+https://github.com/gnuoy/charms.openstack.git@bug/general#egg=charms.openstack +git+https://github.com/openstack/charms.openstack#egg=charms.openstack diff --git a/tox.ini b/tox.ini index 913c681..4c8127f 100644 --- a/tox.ini +++ b/tox.ini @@ -25,13 +25,13 @@ commands = commands = {posargs} [testenv:pep8] -basepython = python3.5 +basepython = python3.4 commands = flake8 {posargs} src/reactive src/lib unit_tests +# Disable py27 tests as this is a reactive python 3 charm. Once project +# config has been updated this tox target can be removed [testenv:py27] -basepython = python2.7 -deps = -r{toxinidir}/test-requirements.txt -commands = ostestr {posargs} +commands = /bin/true [testenv:py34] basepython = python3.4 diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py index 604856b..549fa02 100644 --- a/unit_tests/__init__.py +++ b/unit_tests/__init__.py @@ -20,7 +20,9 @@ sys.path.append('src/lib') # Mock out charmhelpers so that we can test without it. # also stops sideeffects from occuring. +apt_pkg = mock.MagicMock() charmhelpers = mock.MagicMock() +sys.modules['apt_pkg'] = apt_pkg sys.modules['charmhelpers'] = charmhelpers sys.modules['charmhelpers.core'] = charmhelpers.core sys.modules['charmhelpers.core.hookenv'] = charmhelpers.core.hookenv diff --git a/upload-and-publish b/upload-and-publish deleted file mode 100755 index 38f845f..0000000 --- a/upload-and-publish +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# NOTE: relies on new charm publishing features - -set -ex - -owner=${1:-openstack-charmers-next} - -echo "Publishing designate-bind charm to charm store as $owner" - -charm upload build/trusty/designate-bind ~${owner}/designate-bind -charm publish ~${owner}/designate-bind -charm change-perm --set-read everyone ~${owner}/designate-bind