diff --git a/requirements.txt b/requirements.txt index 96d5c76..20f335d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,7 @@ -charm-tools +# This file is managed centrally. If you find the need to modify this as a +# one-off, please don't. Intead, consult #openstack-charms and ask about +# requirements management in charms via bot-control. Thank you. +# +# Build requirements +charm-tools>=2.4.4 simplejson diff --git a/src/lib/charm/openstack/nova_cell_controller.py b/src/lib/charm/openstack/nova_cell_controller.py index 535360f..25ba855 100644 --- a/src/lib/charm/openstack/nova_cell_controller.py +++ b/src/lib/charm/openstack/nova_cell_controller.py @@ -67,6 +67,8 @@ class NovaCellControllerCharm(charms_openstack.charm.HAOpenStackCharm): ]), } + group = 'nova' + sync_cmd = ['nova-manage', 'db', 'sync', '--local_cell'] def get_amqp_credentials(self): diff --git a/src/test-requirements.txt b/src/test-requirements.txt new file mode 100644 index 0000000..4cbbd86 --- /dev/null +++ b/src/test-requirements.txt @@ -0,0 +1,2 @@ +# zaza +git+https://github.com/openstack-charmers/zaza.git#egg=zaza diff --git a/src/tests/bundles/bionic-rocky.yaml b/src/tests/bundles/bionic-rocky.yaml new file mode 100644 index 0000000..0a9f3e7 --- /dev/null +++ b/src/tests/bundles/bionic-rocky.yaml @@ -0,0 +1,146 @@ +series: bionic +relations: +- - nova-cloud-controller:nova-cell-api + - nova-cell-controller-cell2:nova-cell-compute +- - nova-cloud-controller:shared-db-cell + - mysql-cell2:shared-db +- - nova-cloud-controller:amqp-cell + - rabbitmq-server-nova-cell2:amqp +- - nova-compute-cell2:amqp + - rabbitmq-server-nova-cell2:amqp +- - neutron-gateway:amqp + - rabbitmq-server-neutron:amqp +- - neutron-gateway:amqp-nova + - rabbitmq-server-nova:amqp +- - keystone:shared-db + - mysql:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - glance:identity-service + - keystone:identity-service +- - neutron-api:identity-service + - keystone:identity-service +- - neutron-openvswitch:neutron-plugin-api + - neutron-api:neutron-plugin-api +- - neutron-api:shared-db + - mysql:shared-db +- - neutron-api:amqp + - rabbitmq-server-neutron:amqp +- - neutron-gateway:neutron-plugin-api + - neutron-api:neutron-plugin-api +- - glance:shared-db + - mysql:shared-db +- - glance:amqp + - rabbitmq-server-neutron:amqp +- - nova-cloud-controller:image-service + - glance:image-service +- - nova-compute-cell2:image-service + - glance:image-service +- - nova-cell-controller-cell2:cloud-compute + - nova-compute-cell2:cloud-compute +- - nova-cloud-controller:amqp + - rabbitmq-server-nova:amqp +- - nova-cell-controller-cell2:amqp + - rabbitmq-server-nova-cell2:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - nova-compute-cell2:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - neutron-openvswitch:amqp + - rabbitmq-server-neutron:amqp +- - nova-cloud-controller:shared-db + - mysql:shared-db +- - nova-cell-controller-cell2:shared-db + - mysql-cell2:shared-db +- - nova-cloud-controller:neutron-api + - neutron-api:neutron-api +- - nova-compute-cell2:cloud-credentials + - keystone:identity-credentials +- - ntp:juju-info + - nova-compute-cell2:juju-info +- - ntp:juju-info + - neutron-gateway:juju-info +applications: + glance: + charm: cs:glance + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + worker-multiplier: 0.25 + keystone: + charm: cs:keystone + num_units: 1 + options: + admin-password: openstack + openstack-origin: cloud:bionic-rocky + worker-multiplier: 0.25 + mysql: + charm: cs:percona-cluster + num_units: 1 + options: + innodb-buffer-pool-size: 256M + max-connections: 1000 + mysql-cell2: + charm: cs:percona-cluster + num_units: 1 + options: + innodb-buffer-pool-size: 256M + max-connections: 1000 + neutron-api: + charm: cs:neutron-api + num_units: 1 + options: + flat-network-providers: physnet1 + neutron-security-groups: true + openstack-origin: cloud:bionic-rocky + worker-multiplier: 0.25 + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + bridge-mappings: physnet1:br-ex + openstack-origin: cloud:bionic-rocky + worker-multiplier: 0.25 + neutron-openvswitch: + charm: cs:neutron-openvswitch + num_units: 0 + nova-cloud-controller: + charm: cs:~gnuoy/nova-cloud-controller-43 + num_units: 1 + options: + network-manager: Neutron + openstack-origin: cloud:bionic-rocky + worker-multiplier: 0.25 + debug: true + nova-cell-controller-cell2: + charm: nova-cell-controller + series: bionic + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + worker-multiplier: 0.25 + debug: true + cell-name: "cell2" + nova-compute-cell2: + charm: cs:~openstack-charmers-next/nova-compute + num_units: 1 + constraints: mem=4G + options: + config-flags: default_ephemeral_format=ext4 + enable-live-migration: true + enable-resize: true + migration-auth-type: ssh + openstack-origin: cloud:bionic-rocky + debug: true + ntp: + charm: cs:ntp-24 + num_units: 0 + rabbitmq-server-nova: + charm: cs:rabbitmq-server + num_units: 1 + rabbitmq-server-nova-cell2: + charm: cs:rabbitmq-server + num_units: 1 + rabbitmq-server-neutron: + charm: cs:rabbitmq-server + num_units: 1 diff --git a/src/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/src/tests/bundles/overlays/local-charm-overlay.yaml.j2 new file mode 100644 index 0000000..2ed7c4b --- /dev/null +++ b/src/tests/bundles/overlays/local-charm-overlay.yaml.j2 @@ -0,0 +1,4 @@ + +applications: + nova-cell-controller-cell2: + charm: ../../../nova-cell-controller diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml new file mode 100644 index 0000000..0e502df --- /dev/null +++ b/src/tests/tests.yaml @@ -0,0 +1,13 @@ +charm_name: nova-cell-controller +tests: + - zaza.charm_tests.nova.tests.CirrosGuestCreateTest +configure: + - zaza.charm_tests.glance.setup.add_cirros_image + - zaza.charm_tests.glance.setup.add_lts_image + - zaza.charm_tests.neutron.setup.basic_overcloud_network + - zaza.charm_tests.nova.setup.create_flavors + - zaza.charm_tests.nova.setup.manage_ssh_key +gate_bundles: + - bionic-rocky +smoke_bundles: + - bionic-rocky diff --git a/src/tox.ini b/src/tox.ini new file mode 100644 index 0000000..ba390f0 --- /dev/null +++ b/src/tox.ini @@ -0,0 +1,35 @@ +[tox] +envlist = pep8 +skipsdist = True + +[testenv] +setenv = VIRTUAL_ENV={envdir} + PYTHONHASHSEED=0 +whitelist_externals = juju +passenv = HOME TERM CS_API_* OS_* +deps = -r{toxinidir}/test-requirements.txt +install_command = + pip install {opts} {packages} + +[testenv:pep8] +basepython = python2.7 +deps=charm-tools +commands = charm-proof + +[testenv:func-noop] +basepython = python3 +commands = + true + +[testenv:func] +basepython = python3 +commands = + functest-run-suite --keep-model + +[testenv:func-smoke] +basepython = python3 +commands = + functest-run-suite --keep-model --smoke + +[testenv:venv] +commands = {posargs} diff --git a/test-requirements.txt b/test-requirements.txt index 368dbf2..ca62003 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,13 @@ +# This file is managed centrally. If you find the need to modify this as a +# one-off, please don't. Intead, consult #openstack-charms and ask about +# requirements management in charms via bot-control. Thank you. +# # Lint and unit test requirements -flake8 +flake8>=2.2.4,<=2.4.1 os-testr>=0.4.1 +requests>=2.18.4 charms.reactive mock>=1.2 +nose>=1.3.7 coverage>=3.6 -git+https://github.com/openstack/charms.openstack.git#egg=charms-openstack +git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack diff --git a/tox.ini b/tox.ini index cf7da0e..06c404d 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ # within individual charm repos. [tox] skipsdist = True -envlist = pep8,py34,py35,py36 +envlist = pep8,py34,py35 skip_missing_interpreters = True [testenv] @@ -27,7 +27,7 @@ commands = basepython = python2.7 # Reactive source charms are Python3-only, but a py27 unit test target # is required by OpenStack Governance. Remove this shim as soon as -# permitted. http://governance.openstack.org/reference/cti/python_cti.html +# permitted. https://governance.openstack.org/tc/reference/cti/python_cti.html whitelist_externals = true commands = true @@ -47,7 +47,7 @@ deps = -r{toxinidir}/test-requirements.txt commands = ostestr {posargs} [testenv:pep8] -basepython = python3 +basepython = python3.5 deps = -r{toxinidir}/test-requirements.txt commands = flake8 {posargs} src unit_tests