Commit Graph

19 Commits

Author SHA1 Message Date
Stephen Finucane 9679ffc463 Remove six.moves.http_client usage
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>
2022-01-27 14:54:05 +00:00
Abhishek Kekane ffd2f5e63f Fix broken glance-cache-manage utility
glance-cahce-manage is broken due to circilar imports.
Fixed the same by importing 'prefetcher' module right before
'Prefetcher' object is initialized.

Closes-Bug: #1888349
Change-Id: I57d473572ca0a341082bacc3883cd9f763d77fa7
2020-07-23 07:04:52 +00:00
Abhishek Kekane 73fefddd96 Add periodic job to prefetch images into cache
Added new periodic job which will run as per interval set using
'cache_prefetcher_interval' configuration option and fetch images
which are queued for caching in cache directory.

DocImpact
Change-Id: If2875f7a215aca10a6ed2febc89b02219f90a10d
2019-09-10 15:01:58 +00:00
Lucian Petrut 98b7ef195c Allow glance tests to run on Windows
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
2019-03-13 16:41:11 +02:00
Gábor Antal 8a8e5bf56c Extracted HTTP response codes to constants in tests
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
2016-10-06 15:17:06 +00:00
Cyril Roelandt 07eac10c6a Python 3: fix a few simple "str vs bytes" issues.
The HTTP body must be bytes.

This commit fixes:
  glance.tests.functional.test_client_exceptions
  glance.tests.functional.v1.test_multiprocessing

Change-Id: Ifbe98e68000625b0f5c721f815e40bd1244c1200
2016-02-23 16:40:56 +01:00
liyingjun 2365a3fb5f Fix assertEqual arguments order
assertEqual method's arguments should be in ('expected', 'actual')
order.

Change-Id: I88b5b0558720a91236b62b6e4a3590901e817f85
Closes-bug: 1277104
2014-09-19 00:25:18 +08:00
Noboru arai 8de10b0f34 Remove vim header
No need to set tabstop tons of times, this can be set in your vimrc
file instead.

More disucssion:
http://openstack.10931.n7.nabble.com/Remove-vim-modelines-td21780.html

Change-Id: I3b830a5bb831a63c188109e6fad66ba48884fff3
Partial-Bug: #1229324
2014-01-14 16:03:28 +00:00
Jenkins 93edd1bdc6 Merge "Changed header from LLC to Foundation based on trademark policies" 2013-11-12 13:41:45 +00:00
Dirk Mueller 753885d3cd assertEquals is deprecated, use assertEqual
Also change to assertTrue/False where assertEqual(True,/False) was
used.

Change-Id: I9e592d9c40c3da61b5e7af7e7ad5247645249eff
2013-11-07 02:34:48 +01:00
Dirk Mueller 518bbf7298 Changed header from LLC to Foundation based on trademark policies
Fixes: Bug 1214176

Change-Id: I4e394c33d810fe7d48066ff7cb6143f7eae25f13
2013-09-10 18:29:53 +02:00
Stuart McLaren baa4091b14 Fix stale process after unit tests complete
After running the unit tests (eg with tox -epy27) a stale 'nosetests'
process was always left behind.  It left TCP ports open and held references on
inodes. The latter caused a problem with some automated build systems.

Rework the relevant test 'test_no_client_tracebacks' to be functionally
the same, but clean up fully.

Fixes bug 1198685.

Change-Id: If9d3afa370dc2bd3c470b509d38c94cfb5844518
2013-07-07 16:54:53 +00:00
Therese McHale 0e9111ca59 Use one wsgi app, one dbengine worker.
Return to using one wsgi application but use one database engine
per worker process.

Fixes Bug #1089916

Change-Id: Iea4b1b925208317c3c6ee3c9461b6723f3168405
2012-12-19 16:25:09 +00:00
Eoghan Glynn c2f1314bb8 Ensure workers set to 0 for all functional tests
Fixes bug 1054388

Clear up a couple of cases where a functional test fired up a
wsgi.Server without explicitly setting the workers config option
to zero.

Change-Id: I5e2e8fe3c5d6e0c017d27074d35fd79b7dd7d79d
2012-09-22 22:28:12 +01:00
Brian Waldon 112fc71ba4 Instantiate wsgi app for each worker
A single WSGI app, and therefore a single sqlalchemy engine (mysql
connection), was being used across all API workers. This patch
instantiates the WSGI app once per worker rather than up front to
give a separate database connection to each worker.

Fixes bug 1036193

Change-Id: I2cbb61fd88a6ec4fb03fa84196ba0a380b3842d0
2012-09-03 21:04:09 -07:00
Mark McLoughlin 9d9d225419 Port remaining code to global conf object
Implements blueprint cfg-global-object

This iteration fixes up the remaining places where we're passing a
conf object around.

Change-Id: I3b627d093a6b7afeee129ab66b377a3b0af5439b
2012-06-08 17:36:25 +01:00
Mark McLoughlin 1038a19a32 Add cfg's new global CONF object
Implements blueprint cfg-global-object

Begin adopting cfg's global CONF object pattern rather than passing
a conf object around everywhere.

This iterations does just enough to have each of the glance programs
initialize CONF and get the unit tests working.

Change-Id: Ia34959b3ba52cbe933d5d347f31319271b2e14f9
2012-06-05 21:50:55 +01:00
Eoghan Glynn 29b035bcc5 Add new UnexpectedStatus exception.
Raise UnexpectedStatus as opposed to a generic Exception when
an unexpected HTTP status is seen by the glance client.

Further fix for bug 952618

Change-Id: I222c7553e1a687aec0f6dde8215e4400ea6be2cb
2012-03-16 16:05:49 -04:00
Eoghan Glynn c5937221b5 Well-formed exception types for 413 & 503.
Fixes bug 952618

Raise well-formed exception types when 413 or 503
status returned to client.

Change-Id: I26118ff7ec7ba968b303435287d0eb3ff4bd443f
2012-03-15 16:06:52 +00:00