Improve test/utils.py

Introduce new class into utils.py to keep glance api tests DRYer

Partially implements blueprint glance-tests-code-duplication

Change-Id: Ic77961fcc83806fd451afa1a0d230f09926ebfd9
(cherry picked from commit 91a226cb1632636a59b7f742c3158f57ce14b550)
Refactor glance/tests/unit/v2/test_registry_client.py

Remove code duplication from module

Partially implements blueprint glance-tests-code-duplication

Change-Id: Idf54d98d0982b7c64696056c87283eb92f1164b5
(cherry picked from commit 55dcb9e7b19c5901a2aa264b27276094f2a2669f)
Provide explicit image create value in Registry v2 Client test

Assign an explicit created_at datetime value to image db fixtures,
it be used to fixes race condition in Registry v2 Client test cases.

Closes-Bug: #1272136
Change-Id: Ib9f1c7072c6ac828479c6a2e5bddd0f3ad057653
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
(cherry picked from commit 8143d814f2b355b1a2a7a1bd92920641e4d0fb43)
Provide explicit image create value in Registry v2 API test

Assign an explicit created_at datetime value to image db fixtures,
it be used to fixes race condition in Registry v2 API test cases.

Closes-Bug: #1279753
Change-Id: Ia1957e8c024f81eeaa3c0bc094dd62db1be52d07
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
(cherry picked from commit 31bcc97214358482e9ccc035189ef70ced1afc21)
Set python hash seed to 0 in tox.ini

New tox (>=1.7.0) sets a random python hash seed by default. This is
generally good for testing because it will help keep projects working
regardless of the hash seed, but glance unittests don't currently pass
with a random hash seed so set it to the python default seed.

This change will allow us to use new tox again and remove the
restriction on tox<=1.6.1 to run unittests.

Redundant setenvs for specific test envs are removed to prevent them
from overriding the PYTHONHASHSEED value.

Note this change will need to be backported to the stable branches to
keep unittests there working with new tox as well.

Conflicts:
	tox.ini

Change-Id: Id0175b7a95c0ad07798b4603b5d1dd8e6d414561
(cherry picked from commit 90c07019350adc301fa5d91239ebfb16fcac775f)
Updated from global requirements

This is an update for requirements that does not touch version pin for
swiftclient. This should fix -docs failures in havana gate.

The original patch that was modified is:
https://review.openstack.org/#/c/101753/

Change-Id: I912b6d58406b7c66732d32e4902fb1646b5dd7fe
Merge "Improve test/utils.py" into stable/havana
Merge "Refactor glance/tests/unit/v2/test_registry_client.py" into stable/havana
Merge "Provide explicit image create value in Registry v2 Client test" into stable/havana
Merge "Provide explicit image create value in Registry v2 API test" into stable/havana
Enforce image_size_cap on v2 upload

image_size_cap should be checked and enforced on upload

Enforcement is in two places:
- on image metadata save
- during image save to backend store

(cherry picked from commit 92ab00fca6926eaf3f7f92a955a5e07140063718)
Conflicts:
	glance/location.py
	glance/tests/functional/v2/test_images.py
	glance/tests/unit/test_store_image.py

Closes-Bug: 1315321
Change-Id: I45bfb360703617bc394e9e27fe17adf43b09c0e1
Co-Author: Manuel Desbonnet <manuel.desbonnet@hp.com>
Merge "Set python hash seed to 0 in tox.ini" into stable/havana
Merge "Enforce image_size_cap on v2 upload" into stable/havana
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>

Icehouse-Conflicts:
	glance/tests/unit/common/test_wsgi.py

Havana-Conflicts:
	glance/tests/integration/legacy_functional/test_v1_api.py
	glance/tests/unit/common/test_wsgi.py
	glance/tests/unit/test_glance_replicator.py
	glance/tests/unit/test_vmware_store.py
	glance/tests/unit/v2/test_images_resource.py
	glance/tests/unit/v2/test_tasks_resource.py

Partial-bug: #1348818
Change-Id: Ie92c6bb5663826713ca99e8f2f7d70f3faef6675