Commit Graph

16 Commits

Author SHA1 Message Date
Takashi Kajinami fa9450d5b5 Deploy healthcheck middleware as app instead of filter
Using the healthcheck middleware as a filter is deprecated and
the middleware should be used as an application[1].
 [1] 6feaa13610c450c8486f969703768db5319b4846

This change updates definition and usage of the healthcheck middleware
accordingly to avoid the following deprecation warning.

DeprecationWarning: Using function/method 'Healthcheck.factory()' is
deprecated: The healthcheck middleware must now be configured as
an application, not as a filter.

Closes-Bug: #1937901
Change-Id: Id41e0313a481bea4e2bb14c69f2ad8a2070aa9be
2023-05-02 19:21:42 +02:00
Abhishek Kekane b55c0a31c0 Remove registry related functional and unit tests
Registry service is deprecated and due for removal since past
couple of cycles. This patch removes functional and unit tests of
registry.

NOTE:
Skipped 'test_create_with_live_time' test as it was dependent on
test_registry_client and test_registry_api modules. Something is
wrong with the test and will be corrected once entire registry code
is removed from the code base.

Change-Id: I560ab5260bed7e43d83b67a00057ac48f9e366e9
2019-12-18 09:23:37 +00:00
Charles Short 8954959817 Introduce ''mock_object'' method to base test class
We would like to fully remove mox from the test tree. Even for tests
that don't use mox's validation, many of them are using the symbol
patching with self.stubs.Set. We can do the same thing with the
monkeypatch fixture instead.

This introduces self.stub_out to nova/test.py and an example of what a
stubs => stub_out change would look like.

The teardown function in the converted test was removed at the same
time, as those should no longer be used.

Part of the mox community goal for Rocky.

Change-Id: I8f471ff8fee600ebb4e8907bf240007b7b4fe59f
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-08-09 12:40:12 -04:00
zhiguo.li 471fd8dd85 Optimize the way to serach file 'glance-api-paste.ini'
With the original method _get_deployment_config_file() in config.py,
if the option config_file is specified in glance-api.conf, and run
command 'glance-api' under a directory, the the method load_paste_app()
will throw an IOError, but the IOError dose not been catched. The same
error will happen with'glance-registery'.

The reason for this IOError is the code "os.path.abspath(path)" in
_get_deployment_config_file()  will return a value
'{cur_dir}/glance-api-paste.ini', but the 'glance-api-paste.ini' does
not exist under {cur_dir}.Such as running the command under /opt, but
the 'glance-api-paste.ini' dose not exist under /opt.

This pacth modifies one line of code in method _get_paste_config_path()
for solving the IOError. At the same time, it provides one test case.

Change-Id: I970c1acb073700b15e153dd08c9ec14d20f0e83d
Closes-Bug: 1712226
2017-08-24 13:41:26 +08:00
Victor Stinner e14f2da796 Fix Python 3 issues in glance.tests.unit.common
* Open file in text mode to write a paste configuration file, don't open
  in binary mode
* Replace dict.keys()[0] with list(dict.keys())[0], dict.keys() now
  returns an iterator on Python 3
* Replace xrange() with range()
* tox.ini: add the following glance.tests.unit.common tests to Python
  3.4:

  - test_config
  - test_exception
  - test_semver

Change-Id: Ibcfd106cad985b5e08f1e821b3b60a4d0d0911be
2015-08-16 11:39:41 +02:00
Erno Kuvaja 562cb0429f Healthcheck Middleware
Provide healthcheck middleware from oslo_middleware to be able to
disable given nodes from loadbalancer. It's achieved by adding a new
pipeline which depending on existing of the
/etc/glance/healthcheck_disable file can return one of the following
results:

- 200 OK (if file does not exist)
- 503 DISABLED BY FILE (if file exist)

The healthcheck is available under /healthcheck URL, and the whole
mechanism behave similar to the Swift healthcheck system.

implements bp: healthcheck-middleware

Co-Authored-By: Erno Kuvaja <jokke@usr.fi>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>

DocImpact

Change-Id: I45f6a8c59ec3040aaf06f8bab46d8001c44dac7a
2015-07-07 11:55:21 +02:00
Julien Danjou a360ed98bb Switch to mox3
As mox3 is a drop-in Python 3 replacement for mox, let's switch to it.

Change-Id: I0174398c492fdd5e53672dd0f654f220583b75d4
2015-01-26 10:59:26 +01:00
Louis Taylor 090cb56ba1 Disable osprofiler by default
This could cause issues when upgrading to juno, since if config files are not
updated osprofiler can crash.

It is disabled by default in other services, such as cinder and heat.

Change-Id: Ide1be0d42e9e3640560564005b2ce1ffdf554e25
Closes-Bug: #1387320
2014-11-27 11:31:18 +00:00
Boris Pavlovic 725ce9dfa3 Improve Glance profiling
Put osprofiler middleware as a almost first middleware.
This allows us to:
1) Get more preciese duration. We are measuring duration of all middlewares.
2) authenticate middleware is requesting keystone, so if we init osprofiler
   before this middleware, we will get trace infomration from keystone as well.

Change-Id: I11c5d21e6e6b0bd514dee295da410b208d7c798c
2014-08-24 03:58:03 +04:00
Jenkins 2c4bd69565 Merge "Change assertTrue(isinstance()) by optimal assert" 2014-01-19 05:04:52 +00:00
wanghong 3d03291df8 Change assertTrue(isinstance()) by optimal assert
Some of tests use different method of assertTrue(isinstance(A, B)) or
assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B)
provided by testtools.

Change-Id: Ia8d38f73c159c7ef943a8f6cfe72b945cc493947
Closes-bug: #1268480
2014-01-15 19:01:51 +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
Tatyana Leontovich 01c54d96ab Improve unit tests for glance.common package
Add tests for next modules:
* glance.common.wsgi
* glance.common.utils
* glance.common.client
* glance.common.config

Fixes: bug #1152183
Change-Id: Iedbdfb6af411170da10d078e48f5098f8d1c668b
2013-05-20 17:31:22 +03:00