Add .gitreview and clean up repo
Add src/README.md placeholder to prevent inheritence of the base layer's readme file in the built charm. Use the official charms.openstack repo in test-requirements.txt. Use official designate-bind charm location in the Amulet tests. Remove upload-and-publish so as not to encourage out-of-band pushing and publishing. That is handled by CI. Fix a test filename typo. Add tests readme. Update tox.ini for Amulet environment variables. Update metadata.yaml, removing EOL release and adding tags. Fix unit tests Change-Id: If842a5409c2d284bc118d70d6e8caba7cb6205c3
This commit is contained in:
parent
e3d157afa4
commit
3fd2b6a0a4
4
.gitreview
Normal file
4
.gitreview
Normal file
@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/charm-designate.git
|
22
README.md
Normal file
22
README.md
Normal file
@ -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
|
1
src/README.md
Normal file
1
src/README.md
Normal file
@ -0,0 +1 @@
|
||||
# Write me.
|
BIN
src/lib/charm/__init__.pyc
Normal file
BIN
src/lib/charm/__init__.pyc
Normal file
Binary file not shown.
BIN
src/lib/charm/openstack/__init__.pyc
Normal file
BIN
src/lib/charm/openstack/__init__.pyc
Normal file
Binary file not shown.
BIN
src/lib/charm/openstack/designate.pyc
Normal file
BIN
src/lib/charm/openstack/designate.pyc
Normal file
Binary file not shown.
@ -8,9 +8,11 @@ description: |
|
||||
* Integrated with Keystone for authentication
|
||||
* Framework in place to integrate with Nova and Neutron notifications
|
||||
* Support for PowerDNS and Bind9 out of the box
|
||||
tags:
|
||||
- openstack
|
||||
- dns
|
||||
series:
|
||||
- trusty
|
||||
- wily
|
||||
- xenial
|
||||
subordinate: false
|
||||
provides:
|
||||
|
@ -19,6 +19,10 @@ import os
|
||||
import subprocess
|
||||
|
||||
|
||||
def display(msg):
|
||||
print(msg)
|
||||
|
||||
|
||||
def run_command(cmd):
|
||||
os_env = get_environment(os.environ.copy())
|
||||
p = subprocess.Popen(cmd, env=os_env, stdout=subprocess.PIPE,
|
||||
@ -48,7 +52,7 @@ def get_server_id(server_name):
|
||||
def display_server_id(server_name):
|
||||
server_id = get_server_id(server_name)
|
||||
if server_id:
|
||||
print(server_id)
|
||||
display(server_id)
|
||||
|
||||
|
||||
def get_domain_id(domain_name):
|
||||
@ -60,7 +64,7 @@ def get_domain_id(domain_name):
|
||||
def display_domain_id(domain_name):
|
||||
domain_id = get_domain_id(domain_name)
|
||||
if domain_id:
|
||||
print(domain_id)
|
||||
display(domain_id)
|
||||
|
||||
|
||||
def create_server(server_name):
|
||||
@ -73,7 +77,7 @@ def create_server(server_name):
|
||||
'-f', 'value',
|
||||
]
|
||||
out, err = run_command(cmd)
|
||||
print(get_server_id(server_name))
|
||||
display(get_server_id(server_name))
|
||||
|
||||
|
||||
def create_domain(domain_name, domain_email):
|
||||
@ -87,7 +91,7 @@ def create_domain(domain_name, domain_email):
|
||||
'-f', 'value',
|
||||
]
|
||||
out, err = run_command(cmd)
|
||||
print(get_domain_id(domain_name))
|
||||
display(get_domain_id(domain_name))
|
||||
|
||||
|
||||
def delete_domain(domain_name):
|
||||
@ -126,12 +130,12 @@ def get_servers():
|
||||
|
||||
def display_domains():
|
||||
for domain in get_domains():
|
||||
print(domain)
|
||||
display(domain)
|
||||
|
||||
|
||||
def display_servers():
|
||||
for server in get_servers():
|
||||
print(server)
|
||||
display(server)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
9
src/tests/README.md
Normal file
9
src/tests/README.md
Normal file
@ -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.
|
@ -63,8 +63,7 @@ class DesignateBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
|
||||
other_services = [{'name': 'mysql'},
|
||||
{'name': 'rabbitmq-server'},
|
||||
{'name': 'keystone'},
|
||||
{'name': 'designate-bind',
|
||||
'location': 'cs:~gnuoy/trusty/designate-bind-3'}]
|
||||
{'name': 'designate-bind'}]
|
||||
super(DesignateBasicDeployment, self)._add_services(this_service,
|
||||
other_services)
|
||||
|
||||
|
25
src/tests/dev-basic-xenial-newton
Executable file
25
src/tests/dev-basic-xenial-newton
Executable file
@ -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 deployment on xenial-newton."""
|
||||
|
||||
from basic_deployment import DesignateBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = DesignateBasicDeployment(series='xenial',
|
||||
openstack='cloud:xenial-newton',
|
||||
source='cloud:xenial-updates/newton')
|
||||
deployment.run_tests()
|
23
src/tests/dev-basic-yakkety-newton
Executable file
23
src/tests/dev-basic-yakkety-newton
Executable file
@ -0,0 +1,23 @@
|
||||
#!/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 deployment on yakkety-newton."""
|
||||
|
||||
from basic_deployment import DesignateBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = DesignateBasicDeployment(series='yakkety')
|
||||
deployment.run_tests()
|
@ -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}
|
||||
|
@ -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
|
||||
|
6
tox.ini
6
tox.ini
@ -27,10 +27,10 @@ commands = {posargs}
|
||||
[testenv:pep8]
|
||||
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
|
||||
|
@ -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
|
||||
|
Binary file not shown.
@ -228,16 +228,20 @@ class TestDesignateHandlers(unittest.TestCase):
|
||||
self.update_peers.assert_called_once_with(cluster)
|
||||
|
||||
def test_render_all_configs(self):
|
||||
self.patch(handlers.designate, 'update_pools')
|
||||
self.patch(handlers.designate, 'render_full_config')
|
||||
handlers.render_all_configs('arg1', 'arg2')
|
||||
self.render_full_config.assert_called_once_with(('arg1', 'arg2', ))
|
||||
self.update_pools.assert_called_once_with()
|
||||
|
||||
def test_render_all_configs_single_node(self):
|
||||
self.patch(handlers.designate, 'render_full_config')
|
||||
self.patch(handlers.designate, 'render_rndc_keys')
|
||||
self.patch(handlers.designate, 'update_pools')
|
||||
handlers.render_all_configs_single_node('arg1', 'arg2')
|
||||
self.render_full_config.assert_called_once_with(('arg1', 'arg2', ))
|
||||
self.render_rndc_keys.assert_called_once_with()
|
||||
self.update_pools.assert_called_once_with()
|
||||
|
||||
def test_cluster_connected(self):
|
||||
hacluster = mock.MagicMock()
|
||||
|
Binary file not shown.
@ -90,24 +90,27 @@ class TestDesignateUtils(unittest.TestCase):
|
||||
def test_create_server(self):
|
||||
_server_ids = ['servid1', None]
|
||||
self.patch(dutils, 'get_server_id')
|
||||
self.patch(dutils, 'display')
|
||||
self.get_server_id.side_effect = lambda x: _server_ids.pop()
|
||||
self.patch(dutils, 'run_command')
|
||||
self.run_command.return_value = ('out', 'err')
|
||||
self.assertEqual(dutils.create_server('server1'), 'servid1')
|
||||
dutils.create_server('server1')
|
||||
cmd = [
|
||||
'designate', 'server-create',
|
||||
'--name', 'server1',
|
||||
'-f', 'value',
|
||||
]
|
||||
self.run_command.assert_called_with(cmd)
|
||||
self.display.assert_called_with('servid1')
|
||||
|
||||
def test_create_domain(self):
|
||||
_domain_ids = ['domainid1', None]
|
||||
self.patch(dutils, 'get_domain_id')
|
||||
self.patch(dutils, 'display')
|
||||
self.get_domain_id.side_effect = lambda x: _domain_ids.pop()
|
||||
self.patch(dutils, 'run_command')
|
||||
self.run_command.return_value = ('out', 'err')
|
||||
self.assertEqual(dutils.create_domain('dom1', 'email1'), 'domainid1')
|
||||
dutils.create_domain('dom1', 'email1')
|
||||
cmd = [
|
||||
'designate', 'domain-create',
|
||||
'--name', 'dom1',
|
||||
@ -115,8 +118,10 @@ class TestDesignateUtils(unittest.TestCase):
|
||||
'-f', 'value',
|
||||
]
|
||||
self.run_command.assert_called_with(cmd)
|
||||
self.display.assert_called_with('domainid1')
|
||||
|
||||
def test_delete_domain(self):
|
||||
self.patch(dutils, 'get_domain_id', return_value='dom1')
|
||||
self.patch(dutils, 'run_command')
|
||||
dutils.delete_domain('dom1')
|
||||
self.run_command.assert_called_with(['domain-delete', 'dom1'])
|
||||
|
BIN
unit_tests/test_designate_utils.pyc
Normal file
BIN
unit_tests/test_designate_utils.pyc
Normal file
Binary file not shown.
@ -203,7 +203,7 @@ class TestBindRNDCRelationAdapter(Helper):
|
||||
|
||||
def test_rndc_info(self):
|
||||
relation = mock.MagicMock()
|
||||
relation.rndc_info.return_value = 'rndcstuff'
|
||||
relation.rndc_info = 'rndcstuff'
|
||||
a = designate.BindRNDCRelationAdapter(relation)
|
||||
self.assertEqual(a.rndc_info, 'rndcstuff')
|
||||
|
||||
|
BIN
unit_tests/test_lib_charm_openstack_designate.pyc
Normal file
BIN
unit_tests/test_lib_charm_openstack_designate.pyc
Normal file
Binary file not shown.
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# NOTE: relies on new charm publishing features
|
||||
|
||||
set -ex
|
||||
|
||||
owner=${1:-openstack-charmers-next}
|
||||
|
||||
echo "Publishing designate charm to charm store as $owner"
|
||||
|
||||
charm upload build/trusty/designate ~${owner}/designate
|
||||
charm publish ~${owner}/designate
|
||||
charm change-perm --set-read everyone ~${owner}/designate
|
Loading…
x
Reference in New Issue
Block a user