Commit Graph

11 Commits

Author SHA1 Message Date
Hervé Beraud 033a794520 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: I2bb3b81355a3bd9f6f055d1c66b038f4f0abfd0e
2021-12-15 14:21:13 +00:00
Hervé Beraud 1428a3a7dd Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ib361c211cb5537953f5d62f256d1def4796531ab
2020-06-02 19:59:21 +02:00
Adam Dyess 5dda150e02 Unit testing
Increase unit test coverage to 100%

Change-Id: I56320abb0fc5e5112278ab632dee845c48c8980c
2020-01-17 15:01:19 -06:00
Frode Nordahl 871bcaaeb3
Hold services down until config rendered
Change-Id: I1dc570a26bfa97f5612c7b82f06181b2f4e6a665
Closes-Bug: #1837379
2019-07-22 16:59:08 +02:00
Frode Nordahl 21cf26b29c Update charm to use bus to get charm instance
Add ``py3`` target to tox.ini for developer friendliness

Update unit tests to use ``charms.openstack`` unit test helers.

Change-Id: I4752d8e776491f934cd5c1232166933a9ba17746
Partial-Bug: #1837379
2019-07-22 12:51:54 +02:00
Corey Bryant 3bedb660d4 Revert to use of charms.openstack transport_url
Drop charm specific code to build the oslo.messaging
transport_url; this is now provided as part of
charms.openstack.

Change-Id: I1a9bcf7bc57b99326cae618df06930ae3990fab0
Closes-Bug: 1817672
2019-02-26 15:57:48 +01:00
David Ames f17e32ea25 Neutron-dynamic-routing support for SSL rabbitmq
The charm was failing to setup enough SSL configuration to communicate
with rabbitmq when rabbitmq uses SSL. This led to Bug:#1807233.

The change and its dependencies guarantees the charm will setup all the
configuration and certificates required for communication with rabbitmq
and SSL.

Depends-On: I6bb56a59cd65310d644aa25ae203996b22ec4b4e
Change-Id: Id78aba7766e045003ad5661ca31d6a6de57d704a
Closes-Bug: #1807233
2018-12-06 12:00:34 -08:00
David Ames dbee4e8b22 Use the neutron user on the message queue
Similar to neutron-gateway we can use the same user created on the
message queue that neutron-api uses. This will avoid any potential
permissions problems.

Change-Id: I6a5c2f0f38f636db19e3c13af85a79fe5b570013
2018-05-25 13:28:48 -07:00
Frode Nordahl 7be2ae2bd8
Remove asn configuration option
This configuration option is only used for CI testing and
may be confusing for a unsuspecting end user.

Change is coupled with PR on zaza that updates the dragent
test to get information about configured asns by inspecting
relation data on `neutron-dynamic-routing` and `quagga`
units.

Depends-On: I8b1508361fdc7541c0fc231e7e816651626596b7
Change-Id: I41360518ab2e65a207e238d95a39b763897d4fbc
2018-05-21 07:39:04 +02:00
David Ames dc79712d49 Create DRAgentRelationAdapters
Override the amqp adapter the correct way by creating a new relation
adapters class. Use the newer transport_url rather than the older
rabbit_* settings for amqp messaging.

Change-Id: I22b81e25d0e9fc227de4e000540d350c2a635765
2018-05-18 16:56:06 -07:00
David Ames ae26c6f642 Unit tests 2018-04-24 21:36:19 +00:00