This patch will improve tox -e cover when it will be run a summary of
coverage report will be shown afterwards.
Change-Id: I5d10a4ec756dcfea74dfb2bc3d43893caf3f6b26
With this patch it will no longer be required to write each
single proxy variable. It will let pass more variable just
in a single line in future if we add more env variables.
passenv = *_proxy will get all variables like http_proxy,
https_proxy, no_proxy and any_proxy etc.
Change-Id: I8fd137d115380bfeb558706edb52d1ac2d95ca79
Tox does not currently support using factors with sections, and work
towards enabling this has stalled, as such we will need to duplicate
sections adding -constraints to facilitate running sections with the
constrained install_command.
Author: Tom Cammann <tom.cammann@hp.com>
Co-Authored-By: Egor Guz <guz_egor@yahoo.com>
Implements Blueprint: Requirements-Management
Change-Id: Ia36b1794077f29eac189e19552c2d3a4bfe26e5e
We remove old bandit special version txt file and include it
in test-requirements.txt to make sure it can updated by global
automatically.
Change-Id: I03c15eb6d4c1e7a492c37954fce488cbc1fb63d0
This patch adds TestSwarmAPIs test class, aimed to test Docker API/and
swarm related api function, we create a bay while setupClass, and destroy
it after test cases finished. Even without any cased added, at least we can
ensure swarm bay can be created successfully.
This will help to ensure any HOT/yml change won't break swarm's cluster
basic functions.
I leave a todo, we need more works to test container actions.
Since we have created a bay, so we can add more case using magnum client to
test container actions, will do this by followed patch.
Depends-On: Ifa028f6f30b7c2bb7b1dd32b22669379e162c7c5
Partially implements: blueprint swarm-functional-testing
Change-Id: I5c3bc5d7735cce17a45887359d1fb44d12dbba48
This patch splits out api and functional testing case to different directory,
and modify post_test_hook.sh to passing a parameter to calling different tox
venv.
Depends-On: I10e09b2deea7a0643a9516701994cc47813e1aaa
Partially implements: blueprint split-gate-functional-dsvm-magnum
Change-Id: Ic33ea42f6108c7444c152706458cf1a686ed1756
This adds the CORS support middleware to Magnum, allowing a deployer
to optionally configure rules under which a javascript client may
break the single-origin policy and access the API directly.
For magnum, the CORS middleware was directly added to the setup_app
method, as the last middleware to be wrapped around the application
instance. Common headers were added, in order to avoid magic
configuration moments where a feature does not function without
an operator having to read code.
OpenStack CrossProject Spec:
http://specs.openstack.org/openstack/openstack-specs/specs/cors-support.html
Oslo_Middleware Docs:
http://docs.openstack.org/developer/oslo.middleware/cors.html
OpenStack Cloud Admin Guide:
http://docs.openstack.org/admin-guide-cloud/cross_project_cors.html
DocImpact
Change-Id: I7e6d7e2145e3bf883b8a28071c949e10e5c207e0
Closes-bug: #1508209
This patch is mainly porting from nova repository:
Adds:
1.tools/flake8wrap.sh
Will let developer use 'tox -epep8 -- -HEAD' to testing changes files
2.tools/pretty_tox.sh
Give pretty test trace when doing unit/functional testing.
Change-Id: Icedb4ed8b50532531e18784a1584fe63c5a9e017
Reduce cyclomatic complexity of MagnumException to below 10. Remove
exception handling and optimise the logging when the kwargs does not
match the message.
Change-Id: I4fd6ba96be9dff485cdd8bde9750f2d584c1ec63
Closes-Bug: #1501331
The cyclomatic complexity of the setup method was greater than 10 and
reducing this complexity allows for easier understanding of the method.
Change-Id: I45d085d0943fd18a4207fc7a9ba64f2c0f8074ea
Partial-Bug: #1501331
This is method is overly complex and should be broken down. When
reducing the max complexity allowed by flake8 this method was flagged.
Reducing the complexity of this method will allow better testing and
maintenance.
Partial-Bug: #1501331
Change-Id: Id0bdb2d03614ba31de0d96ed09c33695d933b9f7
To allow doc8 testing of the Magnum documentation in CI, doc8 should be
added to the pep8 tox command. After discussion with infra (see change
I6d42cb2092cbaed0cc2ed83f23b7f9ce0b52356f) this has been the suggested
method to allow for doc8 style checking.
As this behaviour is non-obvious I have left the doc8 command in the doc
tox env, this is not run by CI but will be run by users when modifying
and compiling documentation.
Change-Id: I93133e92d792ccc13d61f3ad1281007c2639853b
Two filtering methods had very high cyclomatic complexity, this change
reduces their complexity.
Partial-Bug: #1501331
Change-Id: Idf5dcf83225c35e91cd0fe71eaa7abe32f7f2c6d
This feature is quite useful to detect over-complex code. According to
McCabe, anything that goes beyond 10 is too complex. See
https://en.wikipedia.org/wiki/Cyclomatic_complexity.
Currently the max complexity is 13:
./magnum/service/periodic.py:51:1: C901 'MagnumPeriodicTasks.sync_bay_status' is too complex (11)
./magnum/conductor/handlers/bay_conductor.py:220:1: C901 'HeatPoller.poll_and_check' is too complex (12)
./magnum/common/magnum_keystoneclient.py:97:1: C901 'KeystoneClientV3._v3_client_init' is too complex (10)
./magnum/common/exception.py:192:1: C901 'MagnumException.__init__' is too complex (10)
./magnum/common/utils.py:335:1: C901 'temporary_mutation' is too complex (12)
./magnum/db/sqlalchemy/api.py:125:1: C901 'Connection._add_bays_filters' is too complex (13)
./magnum/db/sqlalchemy/api.py:295:1: C901 'Connection._add_baymodels_filters' is too complex (12)
Setting the max complexity to 14 allows us to not produce anything more
complex. We can work on reducing our complex functions and reducing this
number to 10.
Change-Id: Iaf9c87ecb4873e646d952fd892aafeb7c91fb5e5
Closes-Bug: #1498872
Updated tox.ini and fixed rules.
Fix H405:
Multi line docstring summary not separated with an empty line
Fix E131:
Continuation line unaligned for hanging indent
Change-Id: I20cf75c75cffc434fbdcb05b8e04bffcd4059cd1
Closes-Bug: #1498870
Add doc8 to `tox -edocs` command. doc8 will check syntax/style check
rst documents and fail if not compliant.
Change-Id: Id2e9ed1f96cac27dc5e38f828fd2d824dad31c49
Delete python bytecode before every test run.
Because python creates pyc files during tox runs, certain
changes in the tree, like deletes of files, or switching
branches, can create spurious errors.
Closes-Bug: #1368661
Change-Id: I7e563875848acc7ec767f97b31fc8a95b23ee880
As we have used oslo.policy, so we need to add that in
namespace, as oslo.policy has many settings. This followed
other projects genconfig ways.
Partially-implements: blueprint policy-enforce
Change-Id: I83cce25427b65aad6d26f4ea2d6a48170233a4f3
This patch adds hacking rule check framework for magnum, and adds first rule:
policy.enforce_wsgi decorator must be the first decorator on a method.
refer this link for why we need this rule.
`https://review.openstack.org/#/c/190140/`
Closes-Bugs: #1465895
Change-Id: If98e47426b391b75755ca0b559aee1baa93b8503
When a development environment is under a proxy, tox is failed even if
environment variables of the proxy are set.
This patch fix this problem.
See:
https://review.openstack.org/#/c/189569
Closes-Bug: #1465086
Change-Id: I76727e598ebb77dc146370b576d6992db3ca1ec9
Fix pep8 violations for E121, E122, E123, E124, E125 and remove the
ignored rules from tox.ini.
E125 no longer should be ignored as the rule has been updated and shows
valid styling validation. Other style suggestions for writing long if
statements can be found here https://stackoverflow.com/questions/181530
if this rule violation causes any issue.
Closes-Bug: 1462955
Change-Id: Ic9a31a9dff15da634a97dfe9cdff6d367ecc17e9
By passing posargs to flake8, we can now test pep8 of a single file by passing
file name, eg:
tox -e pep8 magnum/common/service.py
Closes-Bug: #1460495
Change-Id: I8e143b25719c6b375dbd9fc550809f417509e65c
When you are writing a multiple method invocation (or other similar
syntax)
```
obj.method(argument1,
argument2,
...)
```
If you put argument1 in the first line, the following lines should have
the same hanging distance to argument1.
If you put argument1 in the second line, the hanging distance should
always be four.
```
obj.method(
argument1,
argument2,
...
)
```
Otherwise PEP8 would complain for continuation line under/over indented
problems. See below for more details
https://www.python.org/dev/peps/pep-0008/#indentation
This patch fixes all the continuation line indentation problems and
enables related checks in tox.ini.
Closes-bug: #1459514
Change-Id: I80995c2ae71b817ad78a87ab7c567f0d36112710
oslo.log has graduated from oslo-incubator, magnum need use oslo.log
instead of oslo.incubator log module.
NOTE: openstack.common.log registers its options at import time, but
oslo.log needs to call register_options() explicitly.
Change-Id: I671bb020b628bd972813daf5936040b7f1c6bf7a
Closes-Bug: #1459736
- convert the magnum command line in post_test_hook.sh
into test cases
- delete key-pair after functional tests are run
- adding test for creating/deleting baymodels
- adding test for creating/deleting bays
- Remove dummy test (tests/functional/test_magnum.py)
templates.
Partially Implements blueprint: improve-functional-tests
Change-Id: I2937f2659a29e0f9b411c10b080db79bc46ce910
The idea is to make the codebase gate on Bandit. Bandit is
produced by the OpenStack security team to do static code
analysis for security implementation failures. It tests
the code base for ~30 common security problems in Python
with more to come.
run with:
tox -e bandit
Partially-Implements: blueprint gate-bandit
Change-Id: Iade9936268a539384d6067104f02f9a9001c3627
A new test that just uses the python magnum client modules
to make an actual REST call from the functional test harness.
Related-Bug: #1440125
Change-Id: Iac8577fd05abcb4777201bd004bb02691e7f040d
Disable non-supported environment py33 py34 py26 pypy
Since CI folks recommended dropping py33 for all jobs and they all
would get cleaned up, so the new target will be py34 and we should
enable py34 as soon as it has been supported in magnum.
Change-Id: I692f9c7f925e0c5c9744313257125a1d499cbe70
Closes-Bug: #1412230
Create a formal tox target for functional tests.
Also we should not be overriding the user's localrc.
Closes-Bug: #1440125
Change-Id: Ide639ea89050cf3e1f1e9e40c687d506998f7587
newer hacking has rules for the following:
H105 Don't use author tags
H238 old style class declaration, use new style (inherit from `object`)
W292 no newline at end of file
So we need to clean them up and stop ignoring them
Change-Id: I12b995cf87d6bc0938298f397b41a4693627bb4b
docker-py and python-kubernetes are the only ones not in the
global requirements list. We should sync up the versions of
the rest of the libraries.
Change-Id: I0eff3ddecb80f057bb4998a48c8b32b3c1cf8b00
Do the following fixes to pass the tests:
* Add unique constraint to 'ironic_node_id'.
* Throw an exception on deleting a non-existent Node or Container.
* Throw an exception on associating an ironic node to an already
associated magnum node.
* Throw an exception on associating an already associated ironic
node to a magnum node.
* Fix the methods _add_containers_filters and _add_nodes_filters.
Change-Id: Ibf71853e2468ff95d4055be09cb0b460be28a3db