The following options set in functional tests do not exist.
[DEFAULT] send_identity_credentials
[DEFAULT] send_identity_headers
Change-Id: Ia739af13e0f88d0861e453a4d54ecc626e32b34b
This is a rather beefy change due to the number of usages of this
import. The changes are trivial though.
Change-Id: I7badeeaca438b0291f4ed86670e7f217e6372c61
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Recently we have added new non voting job 'functional-py38-rbac' which
will run our functional tests by enabling Secure RBAC. To run functional
tests with Secure RBAC enabled we need to pass 'reader' role to the
requests as well.
Change-Id: I70e085bd6c07548a9d4802fee651e589276a00e5
Made changes to use default policies in our unit and functional tests
rather than referring it from glance/tests/etc/policy.yaml file. Existing
function 'set_policy_rules' can be used to test custom policy rules in
functional testing.
Improvements needed in followup patch:
1. Property protection related unit tests still reads the special policy
from the policy.yaml file, need to make provision to override it instead.
2. Need to remove 'set_policy' function which actually responsible for
above behavior.
Related to blueprint policy-refactor
Change-Id: I0de9b9f9a7de499574101e3366ced730b0cb5fd1
This fixes the cache tests (and the 'caching' deployment flavor) to
send authorization headers so that they can be checked by later policy
patches.
Change-Id: I6099c7da24e06595e08fd292a5083327b9f0cc64
In order to run the unit and functional Glance tests on Windows, we
have to:
* avoid monkey patching the os module on Windows (which causes Popen
to fail)
* update sqlite connection URL
* avoid os.fork, not available on Windows.
* we'll use subprocess.Popen when spinning up http servers.
* for the really simple ones defined in the test helpers, we'll just
use threads
* do not attempt to connect to '0.0.0.0', use '127.0.0.1' instead
* some tests aren't properly skipped (xattr ones), so we're covering that
as well
* skip log rotation test, we can't move in-use files. Log rotation can
be performed by the log handler itself.
* expect an exception when hitting connection timeouts
* avoid installing unavailable test requirements (xattr, pysendfile)
* pin the instance creation timestamp. some tests that deal with
markers rely on ordering, which can be flipped if the timestamps are
identical (can happen in case of resources created one after the
other, not sure yet if this happens really fast or the clock isn't
accurate enough).
* add a few seconds to some timeouts (much needed when running the tests
in VMs).
blueprint windows-support
Change-Id: Ife69f56a3f9f4d81e1e2e47fde4778efd490938f
This change removes option to configure Images API v1
This change removes Images API v1 endpoints from the router
This change removes all v1 tests
This change removes the v1 dependant glance-cache-manage command
This change does not remove all v1 codebase. Further cleanup and
decoupling will be needed.
Change-Id: Ia086230cc8c92f7b7dfd5b001923110d5bc55d4d
This commit adds an external lock to sqlite when launching multiple
worker processes (using uwsgi) the db init will fail for one since the 2
workers will race for initializing the DB. The method is idempotent so
we can safely run it twice in succession, but the lock is necessary to
provides us protection against running it at the same time.
Depends-On: I9a66a8636d12037ff9aa4fb73cc3f9b9343dd7e9
Change-Id: I654c3a5604a89402ba94d9cea44699a48583a7e0
Currently, when a partial download request for an image is received
via v2 api with caching enabled,
* For a new, uncached image:
An attempt to cache (tee'ing) the partially downloaded image
is made which is not desirable. While attempting to do this,
the 206 gets converted to 500 due to a checksum mismatch of
the partial image getting cached vs the entire image.
* For an already cached image:
Cache middleware layer serves the request but sends the entire
image (200 instead of 206)
This patch prevents caching of any partial images that are
being downloaded using v2 api and ensures that any partial
download requests are not served from cache.
Change-Id: I3586c4eda0c36392d3436980f766ed1dd910b47c
Closes-Bug: 1664709
Fixed glance.tests.functional.test_cache_middleware tests to work on
python3.5. Enabled running the tests in tox.ini.
Change-Id: Ie5d4ee52c378aae97f3c944aec8be1a1c4a5edd5
There are several places in the source code where
HTTP response codes are used as numeric values.
These values are used from six.moves and the
numeric values are replaced by constants.
All of the used status codes were replaced with symbolic constants
from six.moves.http_client.
More about six.moves.http_client can be found at [2],
under the table "Supported renames:".
Also, this change improves code readibility.
This patchset does not extract numeric values from
the code itself, but it can be found at [1].
[1]: Ib9e26dcea927e96e65c626c18421621d3a29a64d
[2]: https://pythonhosted.org/six/#module-six.moves
Change-Id: Idfc7b043552f428f01ac3e47b270ee0639a8f5bc
Closes-Bug: #1520159
verbose option is going to be deleted soon (see
https://review.openstack.org/#/c/206437/ for more info
why it deprecated in oslo.log) because it confuses users
(we already have debug option). So we need to delete it from glance
tests.
Change-Id: Iade46a6097d153f2df0da73554bbfd3e2b1704f5
As per http://developer.openstack.org/api-ref-image-v2.html:
"If no image data exists, the call returns the HTTP 204 status code. "
This commit changed that to 403:
d4d94b290c
We should revert to the juno/kilo/liberty behaviour.
APIImpact
Closes-bug: 1549869
Change-Id: Ie9353bc254d11870abc102a7b9b4c7db3917abb4
Utilizing assertIn and assertNotIn in a consistent way rather than
assertTrue( x <not> in y) and assertFalse(x in y).
Change-Id: Ic43d107c40a5a50b852ee476b1167c21e5ad86e8
The new release of glance_store (0.5.0) included
I1d4f95cba47d21f1eb7e580314d01ac8d3481586, which raises errors if
filesystem_store_datadir or filesystem_store_datadirs is not set. Glance
currently is not correctly populating either of those options in certain
unit or functional tests, causing a lot of test failures. This patch
aims to unblock the gate by overriding the CONF option.
Change-Id: I3a9e0c7bfa4a9f38b41e93dce9652c4cc4811a9b
Closes-Bug: #1454384
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.
The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.
Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.
Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages
Change-Id: Ifa8baab33cdb3e606cf175a8c29c3a4ef6c44480
This patch provides the ability to 'deactivate' an image by
providing two new API calls and a new image status 'deactivated'.
Attempting to download a deactivated image will result in a
403 'Forbidden' return code. Also, image locations won't be visible
for deactivated images unless the user is admin.
All other image operations should remain unaffected.
The two new API calls are:
- POST /images/{image_id}/actions/deactivate
- POST /images/{image_id}/actions/reactivate
DocImpact
UpgradeImpact
Change-Id: I32b7cc7ce8404457a87c8c05041aa2a30152b930
Implements: bp deactivate-image
Mainly to improve consistency, use range() from six.moves
renames across glance.
Behaves consistently like py2 xrange() and py3 range().
Removes unnecessary range() from glace/api/v2/images.py
Change-Id: Id21f923d05600b902f2239e25ef01716c07e74a3
Args of assertEquals method in glance.tests are arranged
in wrong order. In result when test fails it shows incorrect
information about observed and actual data. It's found more
than 2000 times. Right order of arguments is "expected, actual".
Change-Id: Ifea4809f5a696b608a19e36a9ed9e5eec46c8a21
Co-Authored-By: Li Yingjun <liyingjun1988@gmail.com>
Closes-Bug: 1277104
In order to improve coding practices and be aligned to a standard,
self.assertEqual(...,True) statements where replaced with
self.assertTrue and self.assertFalse.
Change-Id: I4150a343493beae03d6f71c88e84f60d14fb60e1
Closes-Bug: #1230127
Enable hacking H301: one import per line. H304 and H302 check enables too,
so we temporarily disable it since it does not pass.
Fix imports in files below.
Add # noqa to migration scripts.
Change-Id: I6a8d4dcd9c3195d2848f218aafe304b1240ab60c
in python3.x, there is no method named xrange(),it
has replaced by range(),which is equal to xrange() in
python2.x. so we must fix this issue.we use six module
to fix this issue.
Change-Id: If4fd7478865e8024025af3e57e42f2a24e1e2bbc
Closes-Bug: #1268439
Every call to json.loads/json.dumps have been changed to
jsonutils.loads/jsonutils.dumps respectively. Import json has been removed
also replaced by import glance.openstack.common.jsonutils
654d80b416dc5f413cb791aa838ec8688bf7da44 Create openstack.common.jsonutils
Change-Id: I8ef580e5eb91526dfaef37050ce1f5c6d88d56b5
Closes-bug: #1257922
Clean up imports due to F401 and F403 checks.
F401 'module' imported but unused
F403 unable to detect undefined names with wildcard import
Change-Id: I487edb157de1a6babc7ad8a3fb65f195e476c490
Replace numeric expressions with olso constants to make code
more readable. This patch won't replace single 1024 if 1024 not
in an expression like number * 1024.
Change-Id: Ic1137774f0f9a2be89a7c2706d6eb52eb906ff1f
Currently image cache middleware not care 'download_image' policy, the
enforcement caused user receive empty content but with HTTP 200 code
rather than 403 when client attempt to download image using v2 API. And
the real Forbidden exception be logged in glance-api log which image
application action raised. The end user is confused by this behavior.
Fixes bug: 1235378
Change-Id: Ibaa7ccf8613ee3cce4cb6a72e3206a2c94122222
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Remove the useless arg ("start index" = 0) in files, since its default
value is 0, to make code cleaner.
Change-Id: I9d91ab8a8033b9a6c9b77608dea92c91a994c7fc
This patch makes modifications to the way that programs which the various
tests depend on are forked and executed. This will allow the tests to be
run without installing glance to a python installation (ie: python setup.py
{develop/install} will not be needed).
fixes bug: 1197800
Change-Id: I9687cb7a5b22747d9cea0a1c24057383a8901476
The unused variable 'registry_port' has been removed from function
'test_cache_manage_delete_cached_images'
Fixes bug 1201585
Change-Id: Ib438989f2dd00952a1a1647c101269055088ddaa
Deleting all queued images was broken when using caching with the xattr
driver, due to a missing get_cache_files function.
The missing function can be satisfied by substituting the call to
get_cache_files() with get_all_regular_files()
Fixes bug 1197402
Change-Id: Ia7f289e15615ef31865ebfd23902aa1ae1b05d66
The xattr driver for the caching middleware was returning it's
last_modified/last_accessed times in iso8601 format rather than a
timestamp.
This was inconsistent with the sqlite driver and caused the
glance-cache-manage command to fall over when using the xattr driver.
Fixes bug 1197360
Change-Id: Ie72dcd9f41f7a3b7405cda9fe28e1e468fcc1bef
The executable programs used by Glance have historically been scripts
in the ./bin directory. This patch converts all of the scripts to
entry_points. This change makes these programs python modules. Thus
they can be imported and methods in them can be called just like any
other module. This will allow the tests to call into these programs
directly instead of having to fork out a process.
The conf.py file in the doc tree was causing a name collision with
the python module cmd. The glance/glance directory was being added
to sys.path which made glance.cmd import with the name cmd. This
patch also fixes that problem.
blueprint: refactoring-better-faster-stronger-functional-tests
Change-Id: I67ae14b7403af31a5944befcd2ec27a690e81f15
This patch changes the image domain model so that the transition from
'queued' to 'saving' or 'active' status cannot take place if the image's
disk_format or container_format are not set.
Fixes bug 1131994
Change-Id: I454d9df736edd771f9d5d93eca4cd317116cc985
The API spec specifies the response code for a successful image
upload is supposed to be 204. However, currently the response is
201. This commit fixes this, and sets the response code to 204.
Fixes bug 1136480
Change-Id: I7ea3926c2dd86961f2dd9bc975b10799560ef20a
While doing this, remove some of the nose-isms, which don't play nicely.
Part of blueprint grizzly-testtools
Change-Id: I9ea398b25195ad5f9c5db876c3dbb49ef4a5ee99