Commit Graph

123 Commits

Author SHA1 Message Date
Takashi Kajinami 2a327582f7 Unpin flake8-import-order
... to resolve the following ValueError.

```
ValueError: 'string' is not callable
```

The I202 test is disabled because multiple files need updates. It may
be enabled later once all the warnings are addressed.

Fixed E721 test errors which appears 4 times.

E721 do not compare types, for exact checks use `is` / `is not`, for
instance checks use `isinstance()`

Change-Id: I68880b83c8a555ed30c3ce18b73ae27b8db34dc8
2023-12-14 21:47:34 +09:00
Gregory Thiemonge f21fee9a72 [sqlalchemy2] Turn on RemovedIn20Warnings in tests
Mark all sqlachemy deprecation warnings as 'error', but ignore each
known deprecation at the moment.
Each followup commit will remove one or more 'ignored' deprecation
warnings and will also fix them.

Change-Id: Iedcfc826962ad28446e91d44eea3071c11d16973
2023-05-03 03:02:50 -04:00
Gregory Thiemonge b28be698f8 Fixing tests with tox 4.2.6
Change-Id: I5fdb111cae9a801bb760eeb058ef8e9ff952318d
2023-01-10 14:24:16 +01:00
Tom Weininger 41ee7e7aa1 Fix broken tox.ini with tox4
- scripts were not in allowlist for pep8 environment
- skipsdist setting breaks the docs environment

Change-Id: I5ac930e0d3928bb8acba4212dfff25f788acd442
2023-01-03 16:14:38 +01:00
Takashi Kajinami abf7b9efcf Add conf file for oslo-config-generator
This change introduces the config file for the oslo-config-generator
command, so that users can easily generate octavia.conf.example without
tox.

Note this change adds parameters of oslo.policy and oslo.middleware
which were missing previously.

Change-Id: I5ea921cf8d63b28c5143f95dbb47802d5018d7a4
2022-09-04 05:14:16 +09:00
Gregory Thiemonge 38cb7b6fe8 Drop lower-constraints.txt and its testing
As discussed in TC PTG[1] and TC resolution[2], we are
dropping the lower-constraints.txt file and its testing.
We will keep lower bounds in the requirements.txt file but
with a note that these are not tested lower bounds and we
try our best to keep them updated.

[1] https://etherpad.opendev.org/p/tc-zed-ptg#L326
[2] https://governance.openstack.org/tc/resolutions/20220414-drop-lower-constraints.html#proposal

Change-Id: Ib929fbe28241bd6d3c3bd352b2d900289efd6d49
2022-07-06 18:44:21 +02:00
Tom Weininger 737523f3bc Move to Python 3.8
Update Python base version from 3.6 to 3.8. For Zed the minimum
Python runtime versions are Python 3.8 and 3.9 [1]. As a third
Python version I also added 3.10 already.

Removed ThreadedHTTPServer and replaced it with ThreadingHTTPServer from
standard library, which is new in Python 3.7.

[1]: https://governance.openstack.org/tc/reference/runtimes/zed.html

Change-Id: I035c569b4feaa23b00c0cad50c36aaecf06f7848
2022-05-06 15:04:52 +02:00
Gregory Thiemonge 8ac5aa7cbe Fix docs jobs and pep8 errors with pylint 2.6.2
Remove test-requirements.txt from docs dependencies, add hacking in
doc/requirements. It should reduce the duration of the docs job.

Removed some comments that disabled consider-using-with in pylint,
most of the flagged code is now considered as false positive.

Change-Id: Ib550542820163be2bbef97df7b090834a6b6dccd
2021-10-08 14:17:03 +02:00
Takashi Kajinami b89c929c12 Add caps for pip-extra-reqs/pip-missing-reqs
pip-check-reqs fails with latest pip, cap both packages until
https://github.com/r1chardj0n3s/pip-check-reqs/issues/66 is fixed.

Co-Authored-By: Gregory Thiemonge <gthiemon@redhat.com>

Change-Id: I6ae2740557f0e62b6805e5dadd025e7bf44ec57d
2021-08-06 12:04:56 +02:00
likui 1b365ba489 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: Ia815461a15bff065fd63e9ce80636e2b736bebdf
2021-06-29 13:59:59 +08:00
likui 56f5987867 Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
-https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file
This allows to use lower-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

[1] https://review.opendev.org/#/c/722814/

Change-Id: I82d482bba3e4c40913583fb26f692824c56e6ac1
2021-04-23 20:42:43 +00:00
Michael Johnson beccbb17e2 Gate-Fix: Replace Octavia hacking O349 with H216
The new flake8 includes check H216 to encourage the use of unittest.mock
instead of third party mock modules. Octavia had a hacking check, O349,
for the same purpose. Unfortunately, H216 is flagging that check as
an improper use.
This patch removes O349, in favor of H216, for the Octaiva hacking checks.

Change-Id: I5c11c892ca1184624d6d8e111f69ec30cab2a0d8
2021-04-21 22:25:38 +00:00
Michael Johnson 9b2c6425a3 Bump the minimum coverage to 92%
As we continue to improve our code coverage we can now bump the
gate minimum to 92% minimum.

Change-Id: I53cf76182d2ba9f1aad81edc9da68bedd4a81aba
2021-01-29 23:02:18 +00:00
Brian Haley a4aa03d3bc Fix the unit test tree structure
There were a few unit test files that didn't match their
code counterparts, so were a little hard to find. Moved
things around to line-up better, leaving only a handful
of exceptions to ignore. Added a test script to check
things so it won't happen again, copied from Neutron.

No actual code was changed, files were just moved around.

Change-Id: I6d84047b3481a2bf6bf9bd17d482fb504dbc752b
2021-01-14 15:55:35 -05:00
likui ce6b563ee9 Stop install unnecessary packages when run tox -ereleasenotes
requirements.txt is unnecessary when run tox -e releasenotes,
releasenotes relative stuffs is in doc/requirements.txt

Change-Id: Ia6649ba95bdaa5d4c48f766bc8c1a87bab4f07b3
2020-10-12 13:52:58 +08:00
Michael Johnson 6a3a81b661 Add a requirements.txt check job
This patch adds a new tox environment and gate job that checks
requirements.txt for missing or extra requirements.

Change-Id: Id8c44821455644576cf055cccaa38c9ab2f49ec6
2020-09-18 15:13:12 -07:00
Hervé Beraud 6cce3a72ae 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.

Also added and enabled a hacking check that would have caught this.

Change-Id: Idb10f84fd32c50db24f844352cb85de452181439
2020-06-09 11:25:00 -04:00
Sean McGinnis 0deff25667 Change default tox envs from python37 to python3
Python versions supported by OpenStack change over time, and for minor
versions of Python 3 it is tedious to keep this file updated.

Since this does not impact zuul jobs in any way, nor prevent local
tests against py37, it should be safe to simply make this more easily
compatible for users that don't care about the specific Python versions
and just need basic tests to run.

The *only* thing this does is changes the default versions tested if none
are explicitly provided with `-e`.

Change-Id: I2372178351e961eeed5a819f39e75d54ba148798
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-06-03 07:28:27 -07:00
Andreas Jaeger 79464c0e04 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Add test-requirements.txt to doc building, hacking is now imported and
needed for autodoc.

Change-Id: I06211ef20131c64deba135123e53d87f3b5356a2
2020-03-30 10:03:05 +00:00
Brian Haley bc94789dc9 Stop testing python 2
Since it's no longer supported past Train, lets stop
running the tests.

Change-Id: Ia30435b3bb19acd1d2f9fe217251c393d4f7480e
2019-12-02 12:08:19 -05:00
Zuul 2a60c13863 Merge "Fix controller worker graceful shutdown" 2019-11-18 17:53:52 +00:00
Gregory Thiemonge 215c4c2284 Fix controller worker graceful shutdown
Fix an issue that prevents graceful shutdown of controller workers.

cotyledon.Service.terminate function is by definition the graceful
termination function and doesn't have any 'graceful' optional boolean
argument (https://cotyledon.readthedocs.io/en/latest/api.html).

Because of this error, message_listener.wait() was never called in the
consumers' termination functions, so flows could be interrupted before
completion and could leave resources such as load balancer in a
PENDING_* provisioning state.

By default cotyledon.Service terminates the server after a timeout if
the worker could not shutdown itself gracefully. The default value
for the timeout is 300 seconds (set in devstack plugin) and can be
overriden using the graceful_shutdown_timeout setting in octavia.conf
The default value will be updated to a lower value when work on
persistant taskflow will be merged.

Story: 2006603
Task: 36770

Change-Id: I3f776bd018246897c9a889699a2d0ecbbfbb7098
2019-10-24 14:27:35 +02:00
Zuul 2f1987ccbe Merge "Revert "Clean up requirements.txt from tox.ini"" 2019-10-19 01:02:47 +00:00
Michael Johnson fce2cd4f49 Revert "Clean up requirements.txt from tox.ini"
It appears that these are required to have the upper constraints properly applied. We need to revert this change.

This reverts commit 7b8e6de1b8.

Change-Id: I4941df3894148482c597d30f3a8db70659fd1b7a
2019-10-18 20:55:45 +00:00
Zuul 25c31fe6d2 Merge "Use bandit block in tox.ini" 2019-10-14 22:50:27 +00:00
Zuul 3177aade97 Merge "Clean up requirements.txt from tox.ini" 2019-10-14 13:43:39 +00:00
Jim Rollenhagen 7b8e6de1b8 Clean up requirements.txt from tox.ini
Since the base testenv tox target sets `usedevelop=True`, tox will
install the application (Octavia) into the virtualenv as well. Since
installing Octavia will install everything in requirements.txt, we don't
need to specify it again in tox.ini.

Change-Id: I31bdb2956ae37d1116069c2b37656ce2ee3c2dd5
2019-10-10 18:40:58 -07:00
Brian Haley 65905cdb99 Use bandit block in tox.ini
Use the bandit testenv block in tox.ini instead of inlining
it. Also changed the call back to '-x tests' since that is
correct syntax, it was just broken in version 1.6.0, which
is now in the blacklist.

Change-Id: Id0bf1c6b1633ffb4143c7628b722434faf433d7d
2019-10-10 14:01:40 -04:00
Brian Haley 98448dce44 Add bash script style checker to pep8 check
Added the bashate script style checker to the pep8
check target in tox.ini. It actually found two valid
issues - a bad function declaration and a local variable
issue, but mostly just indentation noise. Fixed all the
complaints.

Change-Id: I43b60e7dcf53acf259c8a52b248fbb8c63d3c8d4
2019-10-10 13:54:58 -04:00
Zuul 3ab36c8a15 Merge "Generate PDF documentation" 2019-09-20 07:05:15 +00:00
Michael Johnson 97058e925b Generate PDF documentation
This patch sets up PDF document generation for Octavia.

Story: 2006101
Task: 35146
Change-Id: I076335d08d5411fd629c3e8860f14980b0dbcb5a
2019-09-19 13:12:37 -07:00
Michael Johnson 05f5257075 Fix a few nits from the main volume-based patch
I had a few minor nits on the volume-based patch. This patch
corrects those.

Co-Authored-By: Adam Harwell <flux.adam@gmail.com>

Change-Id: I5f9ce36c878973f4ed96527af6f1024a362421d8
2019-09-12 10:32:45 +00:00
Michael Johnson 09efc2a423 Add get method support to the driver-agent
This patch adds support for the octavia-lib to get objects by ID.

Change-Id: I98b399891488e5972ea4d332c06b55b34f20fb11
Story: 2005870
Task: 33680
Co-Authored-By: Adam Harwell <flux.adam@gmail.com>
2019-09-09 22:47:10 +00:00
Michael Johnson 518241816c Re-enable the py36 tox environment
A recent automated patch[1] removed py36 from the tox default
environment list. Since Ubuntu 18.04 includes python 3.6 and we
still include a functional-3.6 test, we should keep the py36
environment in the list.

[1] https://review.opendev.org/#/c/669440/

Change-Id: I2bab434523efee0ad755e794f00c3a1ca85ec68f
2019-08-06 17:15:52 -07:00
Andreas Jaeger bc19e07923 Update api-ref location
The api documentation is now published on docs.openstack.org instead
of developer.openstack.org. Update all links that are changed to the
new location.

Note that redirects will be set up as well but let's point now to the
new location.

For details, see:
http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007828.html

Change-Id: I9f617159eddc8af532403e47c325048d92cc9ade
2019-07-22 19:18:40 +02:00
Corey Bryant f8a2560ed9 Add Python 3 Train unit tests
This is a mechanically generated patch to ensure unit testing is in place
for all of the Tested Runtimes for Train.

See the Train python3-updates goal document for details:
https://governance.openstack.org/tc/goals/train/python3-updates.html

Change-Id: I76cdc49e482458a2beefb26b9301023559d16029
Story: #2005924
Task: #34227
2019-07-05 14:03:42 -04:00
tonybrad de30dbb62f Update tox.ini for new upper constraints strategy
The requirements team has defined a new strategy for handling
upper constraints[1]. This patch applies those strategies to
Octavia.
This also corrects a lower constraint for oslo.messaging.

[1] http://lists.openstack.org/pipermail/openstack-discuss/ \
    2019-May/006478.html

Change-Id: I4cf0ad5d14c4378e33423a4d639ec4d0fcc2a614
2019-06-28 17:07:06 -07:00
Michael Johnson 135d999f5e Fix tox for functional py36 and py37
The default tox run had the wrong environment names. functional-36
vs. functional-py36.

Change-Id: I196b21460789b4295ea2dc4ac297b218e26a1e43
2019-05-20 16:11:59 -07:00
Zuul 09020b6bfc Merge "Add Python 3.7 support" 2019-05-16 06:30:28 +00:00
Adit Sarfaty f9455cd94f Remove tests/tempest path from devstack and tox
Commit I3082962841d3b645f3cbd1a6b41fc7fb28dcf7e6 removed
octavia/tests/tempest directory
This patch removed other references to this path.

Change-Id: I665503aa4f69308ff31be53824b26faea13d2ad1
2019-05-15 17:51:14 +03:00
Carlos Goncalves c4faac25de Add Python 3.7 support
In order to support Python 3.7, pylint has to be updated to 2.0.0
minimum. Newer versions of Pylint enforce additional checkers which can
be addressed with some code refactoring rather than silently ignoring
them in pylintrc; except useless-object-inheritance which is required to
be silented so that we stay compatible with Python 2.x.

Story: 2004073
Task: 27434

Change-Id: I52301d763797d619f195bd8a1c32bc47f1e68420
2019-05-14 17:11:22 +00:00
caoyuan 1910f024a3 Replace git.openstack.org URLs with opendev.org URLs
Change-Id: I291eb706df84489398b4f4b2736d7c5ab2e84747
2019-05-13 19:59:59 +00:00
Adam Harwell 1a87298ac7 Bandit test exclusions syntax change
Newer versions of bandit broke their handling of test exclusion
directories. It is now necessary to glob the contents of the directory
rather than just list the base path.

Change-Id: I02fbc02ce8d623b75a7d568ea48bb5e5e6c66b58
2019-05-10 13:30:32 -07:00
Michael Johnson f0776e0cfb Remove python3.5 jobs for Train
The TC has decided that python 3.5 tests are not required for Train
forward[1]. This patch removes the python 3.5 jobs from Octavia.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/ \
    005097.html

Change-Id: Ic75cb45f7c89a80b779ade18a9e4a6f7bf1a6847
2019-04-22 12:59:58 +00:00
Carlos Goncalves b5dda3ce05 Fix functional tests under Python >= 3.6
Newer Python versions don't like passing a mock in to an os.path.join:

  TypeError: join() argument must be str or bytes, not 'MagicMock'

This patch also adds openstack-tox-functional-py36 to the gate queue.
Recent and major LTS distributions ship Python 3.6 or greater.

Change-Id: Ic71059da24e0d2c3f0ac3af5375906d8e8aa43f4
2019-02-09 00:32:59 +01:00
Vieri 43e9283100 Update min tox version to 2.0
The commands used by constraints need at least tox 2.0.  Update to
reflect reality, which should help with local running of constraints
targets.

Change-Id: Ic65e4f789e7394bf73920d17614c60e3e87e3750
Closes-Bug:  #1801477
2018-11-03 06:58:48 +00:00
Nguyen Van Trung 809a383635 Don't quote {posargs} in tox.ini
Quotes around {posargs} cause the entire string to be combined into one
arg that gets passed to stestr. This prevents passing multiple args
(e.g. '--concurrency=16 some-regex')

Change-Id: I7c45e4525f255deec7c79ae567cf4b1dda111a4a
2018-10-22 16:34:59 +00:00
Michael Johnson 57046cf2b9 Raise minimum coverage to 90%
It's time to raise the bar for Octavia coverage. We have been at >= 90%
coverage for a while now, so I'm comfortable proposing raising the
minimum to 90%.

Change-Id: Icd9024d076d3d1c13e35e7e293af3c4fc8406ddf
2018-09-06 16:40:48 -07:00
Erik Olof Gunnar Andersson cfae79cfee Fixing Octavia generating json named file containing yaml
Currently when the command to generate a policy file is used, it will
generate a yaml based file, but call it json.sample.policy. This patch
forces it to generate a json file, and changes the default name to
policy.json.sample.

Change-Id: I4d04f4f37385bd4601f566238aaba43dcbe74780
2018-07-24 13:06:55 +00:00
Doug Hellmann 0322cbc5c3 fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

This patch also updates pylint to 1.5.6 which is compatible with
python3.
In updating pylint we have some issues to correct, this patch addresses
those issues so the Octavia code passes pylint 1.5.6.

Change-Id: Iec21f4c803a427059d595612336d67a35ebf9585
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-27 09:32:00 +08:00