Commit Graph

20 Commits

Author SHA1 Message Date
Erno Kuvaja 3dde3204d5 Remove Images API v1 entry points
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
2018-07-13 10:21:49 +01:00
Alexander Bashmakov b75a0fcc59 Fix and enable integration tests on py35.
Fixed the tests in the `glance.tests.integration` module. Enabled
them to run for py35 job in tox.ini. All changes are related to
string/bytes object differences in python 2.7 vs 3.5.

Also added testing of tasks location header value due to a change in
how it is handled in py27 vs py35.

Change-Id: I26aae0c518fe84c9967461a3b9fef02bc0c17923
2017-04-06 18:14:46 +00:00
Hemanth Makkapati 95c7c1b753 Refactor tests to use Alembic to run migrations
* Functional tests now use alembic instead of sqlalchmey-migrate
  to build and destroy test database.
* All tests now use a file-based sqlite db as opposed to an in-memory
  database.

Partially-Implements: blueprint alembic-migrations
Change-Id: I77921366a05ba6f9841143af89c1f4059d8454c6
Depends-On: Ie8594ff339a13bf190aefa308f54e97ee20ecfa2
2017-02-01 16:08:17 -06:00
Alexander Tivelkov b974a63660 Move Glance Artifact Repository API to separate endpoint
EXPERIMENTAL Glance v3 API has been removed in favor of standalone API
(EXPERIMENTAL Artifacts API of v0.1).
This patch introduces a new process entry point to run on a different
port (9494 by default), with its own configuration file and a paste
config.

A controller stub for old /v3 api remains in the glnace.api package for
the compatibility with existing paste configuration which may reference
it. This stub returns a 301 redirects to glare endpoint if it is present
or 410 errors otherwise.

To reuse  the existing version_negotiation middleware some refactoring
has been made.

Implements blueprint: move-v3-to-glare

Change-Id: I5b7bd4cdcc5f2a40fc4a5f74bcc422fd700c4fb0
2016-02-10 18:34:55 +03:00
Mike Fedosin 6fe3626bb5 Disable v3 API by default
Since v3 is still unstable and has experimental status it's
better to disable it by default for security reasons. This
commit does it by setting 'enable_v3_api=False'.

Also all required documentation was added to related sections.

DocImpact

Change-Id: I412d0645d667400333532123008a24966aa23880
2015-09-03 23:02:26 +03:00
Ian Cordasco cb7d5a4795 Use graduated oslo.policy
This change:

- Adds oslo.policy to the requirements list
- Accounts for changes in Enforcer initialization
- Accounts for changes to config options
- Removes incubated version of oslo.policy
- Updates the in-tree etc/config files

UpgradeImpact

Partially Implements Blueprint: graduate-policy
Change-Id: I5acb1e0f809098991f05ca3b6d78d4d88d98f2db
2015-03-17 23:50:02 -05:00
Louis Taylor e42fad7385 Move from oslo.db to oslo_db
oslo_db was moved out of the oslo namespace in
oslo.db>=1.4.0.

Change-Id: I13620d26ff12c55b2294b3b051669e0e98513a10
Related-to: blueprint drop-namespace-packages
2015-01-12 19:03:20 +00:00
Louis Taylor d759a6fd1a Move from oslo.config to oslo_config
oslo_config was moved out of the oslo namespace in oslo.config>=1.6.0.

Related-to: blueprint drop-namespace-packages

Change-Id: I30ecbf8f9de77496fcb643c7ad9738d79ad359f0
2015-01-12 14:34:22 +00:00
Flavio Percoco 01033f5c64 Just call register_opts in tests
register_opts already registers options for stores as well. Just call
that function instead of calling register_store_opts too.

Change-Id: I7726c098fec1160549251b3dd30ae02bd89bcadc
2014-09-12 15:53:12 +00:00
Flavio Percoco f6e7992a68 Adopt glance.store library in Glance
This commits removes the old `store` package from glance and adopts the
usage of the new glance.store library. The library was designed to
preserve backwards compatibility as much as possible. In fact, most of
the changes in this patch are related to function args ordering and not
function renames or workflow changes.

Some changes that are worth mentioning:

1. Glance store doesn't rely on a global config object. All config
options must be explicitly registered.

2. All store operations now accepted an optional context. This is a
fallout from the context not being required in the `Store` constructor
anymore.

3. Store drivers are behind a private package called `_drivers` and
they're not suppose to be accessed directly. Instead, functions like
`get_store_from_scheme` should be used.

4. Stores are disabled by default

5. All the store specific options are under the `glance_store` group.

DocImpact:
The old store related configuration options have been moved under the
`glance_store` section. However, the old options will go through a
deprecation path. That is, they'll still be read from the `DEFAULT`
section to give deployers enough time to update their config files.

In k-2, the deprecated options will be completely obsolete.

Closes-bug: #1291848
Implements-blueprint: create-store-package

Change-Id: Iaacc70993ad5da292b93de42bbecda73d53b19fd
2014-09-08 15:48:36 +02:00
Louis Taylor e66ecfee4e Fix legacy tests using system policy.json file
Steps to reproduce:

1. Create a new file named '/etc/glance/policy.json' and inside it
paste:

    {"context_is_admin":  "role:admin"}

2. Run tests. Some of the tests under glance.tests.integration
.legacy_functional.test_v1_api will fail with errors such as
'MismatchError: 403 != 201'. These tests will pass without policy.json
in place.

The outcome of the tests should be isolated from the surrounding
environment, so this patch copies policy.json from glance's data files
(glance/tests/etc/policy.json) into the tests directory to avoid this
problem.

Change-Id: I27903ee4ebb7bad243c4f1b2d01096bfb93f1008
Closes-Bug: 1184056
2014-08-26 09:52:08 +00:00
Louis Taylor 65c4e73104 Fix collection order issues and unit test failures
A randomized PYTHONHASHSEED caused the glance API to return certain data
in a nondeterministic order, breaking some tests. This patch sorts the
returned data before testing against a pre-sorted expected values.

This patch also fixes some unit test failures with the new version of
testtools (0.9.36) and directly calling setUp(). This was added to this
patch to avoid blocking more Glance tests.

Co-authored-by: Fei Long Wang <flwang@catalyst.net.nz>
Co-authored-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>

Partial-bug: #1348818

Change-Id: Ie92c6bb5663826713ca99e8f2f7d70f3faef6675
2014-08-23 21:34:26 +08:00
Eugeniya Kudryashova 6185e9d97e Move to oslo.db
Replace common oslo code glance.openstack.common.db
by usage of oslo.db library and remove common code.

Change-Id: I27216e03763f72e8665121d4440ba2828349eac5
2014-07-21 12:31:10 +03:00
eddie-sheffield f437586026 Remove dependency of test_v1_api on other tests
test_v1_api would fail if run by itself. A config value was
apparently being set by another test so that this test would
pass if run as part of the whole suite but not alone.

Specifically, the missing value was 'backend' in group 'database'.

This patch imports the 'backend' option in base.py which is the
base of test_v1_api.

Change-Id: I37d72398050057def6a378e03c14a9a4eeb55a16
Closes-bug: #1283242
2014-03-01 22:22:45 -05:00
Victor Sergeyev 99fb66ca80 Use common db migrations module from Oslo
Changes due to use common migration module instead of Glance
implementation.
Removed glance.db.sqlalchemy.migration module and related code.

blueprint db-use-oslo-common-code

Change-Id: Ib7e2e478a84a90cc9c773f2733dc60b88834fd23
2014-01-25 11:04:55 +02:00
Boris Pavlovic 048a40c0b5 Use common Oslo database session
Use common oslo database code for work with session, connection, engines
instead of glance implementations.
Work with config options modified due to new common code config.
Removed unused glance code and tests for it.

Details:

glance/cmd/manage.py
- removed load load the glance-registry config. We load sql connection
  in common code now.

glance/db/sqlalchemy/api.py
- removed functions _wrap_db_error(), _is_db_connection_error(),
  _get_maker(), get_engine(), _ping_listener() and config
  `sql_connection_opt`. We have all these thigs in module
  `glance.openstack.common.db.sqlalchemy`.
- modified functions setup_db_env(), add_cli_options(), clear_db_env().
- functions _get_session() and get_engine() now call same functions
  from module `glance.openstack.common.db.sqlalchemy`.
- replaced sqlalchemy exception `sqlalchemy.exc.IntegrityError` to
  database duplicate exception - `db_exc.DBDuplicateEntry`.

Removed redundant tests - we use common code , so a lot of features was
already tested in Oslo.

Global variable _ENGINE was replaced by common function get_engine().

DocImpact
New database config options came from Oslo. See Table below
-------------------------------------------------------------------
Database config options ([group] option)
-----------------------------|-------------------------------------
       Glance                | Oslo
-----------------------------|-------------------------------------
[DEFAULT] sql_connection     |  [database] connection
[DEFAULT] sql_idle_timeout   |  [database] idle_timeout
[DEFAULT] sql_max_retries    |  [database] max_retries
[DEFAULT] sql_retry_interval |  [database] retry_interval
[DEFAULT] db_auto_create     |  NONE
[DEFAULT] sqlalchemy_debug   |  [database] connection_debug
[DEFAULT] use_tpool          |  [database] use_tpool
NONE                         |  [database] slave_connection
NONE                         |  [database] min_pool_size
NONE                         |  [database] max_pool_size
NONE                         |  [database] slave_connection
NONE                         |  [database] min_pool_size
NONE                         |  [database] max_pool_size
NONE                         |  [database] max_overflow
NONE                         |  [database] connection_trace
NONE                         |  [database] pool_timeout
-------------------------------------------------------------------

blueprint db-use-oslo-common-code

Change-Id: I3ff976545b1a82ff8df780e34128fcaf6f892b8c
2014-01-03 05:37:41 +04:00
Dirk Mueller d6114f914c Fix and enable gating on H306
Fix fallout of Hacking check: Imports should be in alphabetical order

Change-Id: I179711c8448208592490ffa47d51419779940014
2014-01-01 16:44:19 +01:00
Yanis Guenane ec08ca1a87 Make code base E125 and E126 compliant
This commit makes the glance code base E125 and E126 compliant :
  * E125 continuation line does not distinguish itself from next logical line
  * E126 continuation line over-indented for hanging indent

Change-Id: I7120149bedb665fb66320498fe98948602a6cd52
Closes-bug: #1263437
2013-12-30 13:03:24 +00:00
Paul Bourke 08987b12eb Implement protected properties for API v1
Related to bp api-v2-property-protection

DocImpact

Change-Id: Ia56ca251e78f37dcd6cf63c9696f0e5e07ed5f5c
2013-09-10 15:05:48 +00:00
Mark J. Washenberger 541419dfa0 Port slow, overly assertive v1 functional tests to integration tests
This patch ports existing v1 api functional tests to a newly added group
of integration tests. The new tests take about 1/8th of the time of the
previous tests, thanks to not forking off api and registry server
processes.

One original functional test is preserved, to ensure that we are still
testing the basic v1 functional wireup.

Related to bp refactoring-better-faster-stronger-functional-tests

Change-Id: Ifcc76b4bf4e484a52558538e5398cad882e48e4c
2013-06-21 19:09:43 -07:00