Fix manila driverfixes/newton checks

Branch is broken so we need 2 fixes:

1) Add upper-constraints.txt from stable/newton

   This will be used to set the upper-constraints for unit
   test jobs on this branch.

2) Backport "Remove usage of parameter enforce_type"

   oslo.config has deprecated the enforce_type parameter to
   set_override() and set its default value to True [1],
   so remove this usage from our codebase.  Also remove
   explict str() cast of mock.sentinel_password in
   Windows driver since it should no longer be expected.

   [1] Ifa552de0a994e40388cbc9f7dbaa55700ca276b0
   (cherry-picked from 4e25ce5a0c)

Change-Id: Id7db496441f6c1d620a4995812ed4f8c98a00ad5
This commit is contained in:
Rodrigo Barbieri 2018-01-12 15:11:52 -02:00
parent d492c6c557
commit cb76d2febc
13 changed files with 433 additions and 37 deletions

View File

@ -173,7 +173,7 @@ class TestCase(base_test.BaseTestCase):
def flags(self, **kw):
"""Override flag variables for a test."""
for k, v in kw.items():
CONF.set_override(k, v, enforce_type=True)
CONF.set_override(k, v)
def start_service(self, name, host=None, **kwargs):
host = host and host or uuid.uuid4().hex

View File

@ -260,7 +260,7 @@ class ManilaCmdManageTestCase(test.TestCase):
@mock.patch('six.moves.builtins.open')
@mock.patch('os.listdir')
def test_get_log_commands_errors(self, listdir, open):
CONF.set_override('log_dir', 'fake-dir', enforce_type=True)
CONF.set_override('log_dir', 'fake-dir')
listdir.return_value = ['fake-error.log']
with mock.patch('sys.stdout', new=six.StringIO()) as fake_out:

View File

@ -38,10 +38,9 @@ class ManilaCmdShareTestCase(test.TestCase):
self.mock_object(self.launcher, 'launch_service')
self.mock_object(self.launcher, 'wait')
self.server = manila_share.service.Service.create.return_value
fake_host = 'fake_host'
CONF.set_override('enabled_share_backends', backends,
enforce_type=True)
CONF.set_override('host', fake_host, enforce_type=True)
fake_host = 'fake.host'
CONF.set_override('enabled_share_backends', backends)
CONF.set_override('host', fake_host)
sys.argv = ['manila-share']
manila_share.main()

View File

@ -425,8 +425,7 @@ class CephFSNativeDriverTestCase(test.TestCase):
def test_connect_noevict(self):
# When acting as "admin", driver should skip evicting
self._driver.configuration.local_conf.set_override('cephfs_auth_id',
"admin",
enforce_type=True)
"admin")
self._driver.create_share(self._context,
self._share)

View File

@ -53,17 +53,17 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
self.config.append_config_values(na_opts.netapp_provisioning_opts)
self.config.append_config_values(na_opts.netapp_replication_opts)
CONF.set_override("share_backend_name", self.backend,
group=self.backend, enforce_type=True)
group=self.backend)
CONF.set_override("netapp_transport_type", "https",
group=self.backend, enforce_type=True)
group=self.backend)
CONF.set_override("netapp_login", "fake_user",
group=self.backend, enforce_type=True)
group=self.backend)
CONF.set_override("netapp_password", "fake_password",
group=self.backend, enforce_type=True)
CONF.set_override("netapp_server_hostname", "fake_hostname",
group=self.backend, enforce_type=True)
group=self.backend)
CONF.set_override("netapp_server_hostname", "fake.hostname",
group=self.backend)
CONF.set_override("netapp_server_port", 8866,
group=self.backend, enforce_type=True)
group=self.backend)
def test_get_client_for_backend(self):
self.mock_object(data_motion, "get_backend_configuration",
@ -72,7 +72,7 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
data_motion.get_client_for_backend(self.backend)
self.mock_cmode_client.assert_called_once_with(
hostname='fake_hostname', password='fake_password',
hostname='fake.hostname', password='fake_password',
username='fake_user', transport_type='https', port=8866,
trace=mock.ANY, vserver=None)
@ -81,19 +81,19 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
mock.Mock(return_value=self.config))
CONF.set_override("netapp_vserver", 'fake_vserver',
group=self.backend, enforce_type=True)
group=self.backend)
data_motion.get_client_for_backend(self.backend)
self.mock_cmode_client.assert_called_once_with(
hostname='fake_hostname', password='fake_password',
hostname='fake.hostname', password='fake_password',
username='fake_user', transport_type='https', port=8866,
trace=mock.ANY, vserver='fake_vserver')
def test_get_config_for_backend(self):
self.mock_object(data_motion, "CONF")
CONF.set_override("netapp_vserver", 'fake_vserver',
group=self.backend, enforce_type=True)
group=self.backend)
data_motion.CONF.list_all_sections.return_value = [self.backend]
config = data_motion.get_backend_configuration(self.backend)
@ -103,9 +103,9 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
def test_get_config_for_backend_different_backend_name(self):
self.mock_object(data_motion, "CONF")
CONF.set_override("netapp_vserver", 'fake_vserver',
group=self.backend, enforce_type=True)
group=self.backend)
CONF.set_override("share_backend_name", "fake_backend_name",
group=self.backend, enforce_type=True)
group=self.backend)
data_motion.CONF.list_all_sections.return_value = [self.backend]
config = data_motion.get_backend_configuration(self.backend)

View File

@ -595,8 +595,7 @@ SSC_DISK_TYPES = ['FCAL', ['SATA', 'SSD']]
def get_config_cmode():
config = na_fakes.create_configuration_cmode()
config.local_conf.set_override('share_backend_name', BACKEND_NAME,
enforce_type=True)
config.local_conf.set_override('share_backend_name', BACKEND_NAME)
config.reserved_share_percentage = 5
config.netapp_login = CLIENT_KWARGS['username']
config.netapp_password = CLIENT_KWARGS['password']

View File

@ -120,8 +120,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
config = na_fakes.create_configuration()
config.local_conf.set_override('driver_handles_share_servers',
mode == na_common.MULTI_SVM,
enforce_type=True)
mode == na_common.MULTI_SVM)
kwargs = {
'configuration': config,
'private_storage': mock.Mock(),
@ -136,8 +135,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
def test_create_driver_case_insensitive(self):
config = na_fakes.create_configuration()
config.local_conf.set_override('driver_handles_share_servers', True,
enforce_type=True)
config.local_conf.set_override('driver_handles_share_servers', True)
kwargs = {
'configuration': config,

View File

@ -82,7 +82,7 @@ class WindowsServiceInstanceManagerTestCase(test.TestCase):
if not use_cert_auth:
mock_check_complexity.assert_called_once_with(
str(mock.sentinel.password))
mock.sentinel.password)
@ddt.data(False, True)
def test_get_auth_info(self, use_cert_auth):
@ -165,7 +165,7 @@ class WindowsServiceInstanceManagerTestCase(test.TestCase):
expected_kwargs = dict(user_data=mock_cert_data)
else:
expected_kwargs = dict(
meta=dict(admin_pass=str(mock.sentinel.admin_pass)))
meta=dict(admin_pass=mock.sentinel.admin_pass))
create_kwargs = self._mgr._get_service_instance_create_kwargs()

View File

@ -38,7 +38,7 @@ class ConfigTestCase(test.TestCase):
self.assertEqual(42, CONF.answer)
# Make sure we don't overwrite anything
CONF.set_override('answer', 256, enforce_type=True)
CONF.set_override('answer', 256)
self.assertEqual(256, CONF.answer)
CONF.import_opt('answer', 'manila.tests.declare_conf')
self.assertEqual(256, CONF.answer)

View File

@ -41,8 +41,7 @@ class PolicyFileTestCase(test.TestCase):
def test_modified_policy_reloads(self):
with utils.tempdir() as tmpdir:
tmpfilename = os.path.join(tmpdir, 'policy')
CONF.set_override('policy_file', tmpfilename, group='oslo_policy',
enforce_type=True)
CONF.set_override('policy_file', tmpfilename, group='oslo_policy')
action = "example:test"
with open(tmpfilename, "w") as policyfile:
policyfile.write("""{"example:test": []}""")

View File

@ -190,8 +190,7 @@ class CinderApiTestCase(test.TestCase):
volume['attach_status'] = "detached"
instance = {'availability_zone': 'zone1'}
volume['availability_zone'] = 'zone2'
cinder.CONF.set_override('cross_az_attach', False, 'cinder',
enforce_type=True)
cinder.CONF.set_override('cross_az_attach', False, 'cinder')
self.assertRaises(exception.InvalidVolume,
self.api.check_attach, self.ctx, volume, instance)
volume['availability_zone'] = 'zone1'
@ -203,8 +202,7 @@ class CinderApiTestCase(test.TestCase):
volume['attach_status'] = "detached"
volume['availability_zone'] = 'zone1'
instance = {'availability_zone': 'zone1'}
cinder.CONF.set_override('cross_az_attach', False, 'cinder',
enforce_type=True)
cinder.CONF.set_override('cross_az_attach', False, 'cinder')
self.assertIsNone(self.api.check_attach(self.ctx, volume, instance))
cinder.CONF.reset()

View File

@ -6,7 +6,7 @@ envlist = py34,py27,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton} {opts} {packages}
install_command = pip install -cupper-constraints.txt {opts} {packages}
whitelist_externals = find
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt

404
upper-constraints.txt Normal file
View File

@ -0,0 +1,404 @@
# taken from openstack/requirements stable/newton @ aec3ee5
APScheduler===3.2.0
Babel===2.3.4
CouchDB===1.1
Django===1.8.14
Flask===0.11.1
GitPython===2.0.8
Jinja2===2.8
Mako===1.0.4
MarkupSafe===0.23
MySQL-python===1.2.5;python_version=='2.7'
Parsley===1.3
Paste===2.0.3
PasteDeploy===1.5.2
Pillow===3.3.1
Pint===0.7.2
PuLP===1.6.1
PyECLib===1.2.0
PyJWT===1.4.2
PyKMIP===0.5.0
PyMySQL===0.7.6
PyYAML===3.12
Pygments===2.1.3
Routes===2.3.1
SQLAlchemy===1.0.14
SQLAlchemy-Utils===0.32.9
SecretStorage===2.3.1
Sphinx===1.2.3
Tempita===0.5.2
WSME===0.8.0
WebOb===1.6.1
WebTest===2.0.23
Werkzeug===0.11.11
XStatic===1.0.1
XStatic-Angular===1.4.10.1
XStatic-Angular-Bootstrap===0.11.0.8
XStatic-Angular-FileUpload===12.0.4.0
XStatic-Angular-Gettext===2.1.0.2
XStatic-Angular-Schema-Form===0.8.13.0
XStatic-Angular-lrdragndrop===1.0.2.2
XStatic-Bootstrap-Datepicker===1.3.1.0
XStatic-Bootstrap-SCSS===3.3.7.1
XStatic-D3===3.1.6.2
XStatic-Font-Awesome===4.5.0.0
XStatic-Hogan===2.0.0.2
XStatic-JQuery-Migrate===1.2.1.1
XStatic-JQuery.TableSorter===2.14.5.1
XStatic-JQuery.quicksearch===2.0.3.1
XStatic-JSEncrypt===2.0.0.2
XStatic-Jasmine===2.4.1.1
XStatic-Magic-Search===0.2.5.1
XStatic-Rickshaw===1.5.0.0
XStatic-Spin===1.2.5.2
XStatic-bootswatch===3.3.6.0
XStatic-jQuery===1.10.2.1
XStatic-jquery-ui===1.11.0.1
XStatic-mdi===1.4.57.0
XStatic-objectpath===1.2.1.0
XStatic-roboto-fontface===0.4.3.2
XStatic-smart-table===1.4.13.2
XStatic-term.js===0.0.7.0
XStatic-tv4===1.2.7.0
XenAPI===1.2
alembic===0.8.7
amqp===1.4.9
anyjson===0.3.3
aodhclient===0.7.0
appdirs===1.4.3
astroid===1.3.8
autobahn===0.16.0
automaton===1.4.0
backports.ssl-match-hostname===3.5.0.1;python_version=='2.7'
bandit===1.1.0
bashate===0.5.1
beautifulsoup4===4.5.1
betamax===0.8.0
blockdiag===1.5.3
boto===2.42.0
botocore===1.4.50
cachetools===1.1.6
cassandra-driver===3.5.0
castellan===0.4.0
ceilometermiddleware===0.5.2
cffi===1.7.0
chardet===2.3.0
click===6.6
cliff===2.2.0
cliff-tablib===2.0
cmd2===0.6.8
colorama===0.3.7
configparser===3.5.0
contextlib2===0.5.4
coverage===4.2
crc16===0.1.1
croniter===0.3.12
cryptography===1.5
cursive===0.1.1
ddt===1.1.0
debtcollector===1.8.0
decorator===4.0.10
demjson===2.2.4
dib-utils===0.0.10
discover===0.4.0
diskimage-builder===1.19.0
django-appconf===1.0.2
django-babel===0.5.1
django-compressor===2.1
django-floppyforms===1.7.0
django-formtools===1.0
django-nose===1.4.4
django-openstack-auth===2.4.2
django-pyscss===2.0.2
dnspython===1.14.0
dnspython3===1.12.0;python_version=='3.4'
dnspython3===1.12.0;python_version=='3.5'
doc8===0.7.0
docker-py===1.7.2
docutils===0.12
dogpile.cache===0.6.2
elasticsearch===2.4.0
enum34===1.1.6
eventlet===0.19.0
extras===1.0.0
fairy-slipper===0.2.0
falcon===1.0.0
fasteners===0.14.1
fixtures===3.0.0
freezegun===0.3.7
frozendict===1.0
funcparserlib===0.3.6
funcsigs===1.0.2;python_version=='2.7'
functools32===3.2.3.post2;python_version=='2.7'
futures===3.0.5
futurist===0.18.0
gabbi===1.24.0
gitdb===0.6.4
glance-store===0.18.0
google-api-python-client===1.5.3
graphviz===0.4.10
greenlet===0.4.10
happybase===1.0.0;python_version=='2.7'
heat-translator===0.5.0
hiredis===0.2.0
httplib2===0.9.2
icalendar===3.10
idna===2.1
ipaddress===1.0.16;python_version=='2.7'
ironic-lib===2.1.3
iso8601===0.1.11
itsdangerous===0.24
jmespath===0.9.0
jsonpatch===1.14
jsonpath-rw===1.4.0
jsonpath-rw-ext===1.0.0
jsonpointer===1.10
jsonschema===2.5.1
kafka-python===0.9.5
kazoo===2.2.1
keyring===9.3.1
keystoneauth1===2.12.3
keystonemiddleware===4.9.1
kombu===3.0.35
krest===1.3.1
ldap3===1.4.0
ldappool===2.1.0
libvirt-python===2.1.0
linecache2===1.0.0
logilab-common===1.2.2
logutils===0.3.3
lxml===3.6.4
microversion-parse===0.1.4
mistral===3.0.2
mock===2.0.0
monasca-common===1.0.0
monasca-statsd===1.1.0
monotonic===1.2
mox===0.5.3
mox3===0.18.0
mpmath===0.19
msgpack-python===0.4.8
ndg-httpsclient===0.4.2;python_version=='2.7'
netaddr===0.7.18
netifaces===0.10.5
netmiko===0.5.6
networkx===1.11
neutron-lib===0.4.0
nodeenv===0.13.6
nose===1.3.7
nose-exclude===0.4.1
nosehtmloutput===0.0.5
nosexcover===1.0.10
notifier===1.0.3
numpy===1.11.1
oauth2client===3.0.0
oauthlib===1.1.2
openstack-doc-tools===1.0.1
openstack.nose-plugin===0.11
openstackdocstheme===1.5.0
openstacksdk===0.9.5
ordereddict===1.1
os-api-ref===1.0.0
os-apply-config===5.1.0
os-brick===1.6.2
os-client-config===1.21.1
os-cloud-config===5.1.0
os-collect-config===5.2.0
os-refresh-config===5.2.0
os-testr===0.8.0
os-vif===1.2.1
os-win===1.2.2
osc-lib===1.1.0
oslo.cache===1.14.1
oslo.concurrency===3.14.1
oslo.config===3.17.1
oslo.context===2.9.0
oslo.db===4.13.6
oslo.i18n===3.9.0
oslo.log===3.16.1
oslo.messaging===5.10.2
oslo.middleware===3.19.1
oslo.policy===1.14.0
oslo.privsep===1.13.2
oslo.reports===1.14.0
oslo.rootwrap===5.1.2
oslo.serialization===2.13.2
oslo.service===1.16.1
oslo.utils===3.16.1
oslo.versionedobjects===1.17.1
oslo.vmware===2.14.1
oslosphinx===4.7.0
oslotest===2.10.1
osprofiler===1.4.0
ovs===2.5.0;python_version=='2.7'
ovs===2.6.0.dev3;python_version=='3.4'
ovs===2.6.0.dev3;python_version=='3.5'
packaging===16.8
paramiko===2.0.2
passlib===1.6.5
pathlib===1.0.1;python_version=='2.7'
pbr===1.10.0
pecan===1.1.2
pexpect===4.2.1
pifpaf===0.12.0
pika===0.10.0
pika-pool===0.1.3
ply===3.9
positional===1.1.1
posix-ipc===1.0.0
prettytable===0.7.2
proboscis===1.2.6.0
psutil===1.2.1
psycopg2===2.6.2
ptyprocess===0.5.1
py===1.4.31
pyOpenSSL===16.2.0
pyScss===1.3.4
pyasn1===0.1.9
pyasn1-modules===0.0.8
pycadf===2.4.0
pycparser===2.14
pycrypto===2.6.1
pydotplus===2.0.2
pyghmi===1.0.9
pyinotify===0.9.6
pykerberos===1.1.13;python_version=='2.7'
pyldap===2.4.25.1
pylxd===2.0.3
pymemcache===1.3.6
pymod2pkg===0.5.4
pymongo===3.3.0
pyngus===2.1.2
pyparsing===2.1.10
pyroute2===0.4.6
pysaml2===4.0.2
pysendfile===2.0.1
pysmi===0.0.7
pysnmp===4.3.2
pystache===0.5.4
pytest===3.0.1
python-barbicanclient===4.0.1
python-ceilometerclient===2.6.2
python-cinderclient===1.9.0
python-congressclient===1.5.0
python-consul===0.6.1
python-dateutil===2.5.3
python-designateclient===2.3.0
python-editor===1.0.1
python-glanceclient===2.5.0
python-heatclient===1.5.2
python-ironic-inspector-client===1.10.0
python-ironicclient===1.7.1
python-k8sclient===0.3.0
python-karborclient===0.1.0
python-keystoneclient===3.5.1
python-magnumclient===2.3.1
python-manilaclient===1.11.0
python-memcached===1.58
python-mimeparse===1.5.2
python-mistralclient===2.1.2
python-monascaclient===1.2.1
python-muranoclient===0.11.1
python-neutronclient===6.0.1
python-novaclient===6.0.2
python-openstackclient===3.2.1
python-pytun===2.2.1
python-qpid-proton===0.14.0
python-saharaclient===0.18.0
python-searchlightclient===1.0.0
python-senlinclient===1.0.0
python-smaugclient===0.0.8
python-solumclient===2.0.1
python-statsd===2.0.0
python-subunit===1.2.0
python-swiftclient===3.1.0
python-tackerclient===0.7.0
python-troveclient===2.5.0
python-watcherclient===0.25.1
python-zaqarclient===1.2.0
pytz===2016.6.1
pyudev===0.21.0
pyzabbix===0.7.4
pyzmq===15.4.0
qpid-python===0.32.1;python_version=='2.7'
rcssmin===1.0.6
redis===2.10.5
reno===1.9.0
repoze.lru===0.6
repoze.who===2.3
requests===2.11.1
requests-aws===0.1.8
requests-kerberos===0.10.0;python_version=='2.7'
requests-mock===1.0.0
requests-unixsocket===0.1.5
requestsexceptions===1.1.3
restructuredtext-lint===0.17.0
retrying===1.3.3
rfc3986===0.4.1
rjsmin===1.0.12
rsa===3.4.2
rtslib-fb===2.1.58
ryu===4.5
scikit-learn===0.17.1
scipy===0.18.0
scp===0.10.2
selenium===2.53.6
semantic-version===2.5.0
seqdiag===0.9.5
simplegeneric===0.8.1
simplejson===3.8.2
singledispatch===3.4.0.3;python_version=='2.7'
six===1.10.0
smmap===0.9.0
spec-cleaner===0.9.0
sphinxcontrib-blockdiag===1.5.5
sphinxcontrib-httpdomain===1.5.0
sphinxcontrib-pecanwsme===0.8.0
sphinxcontrib-seqdiag===0.8.5
sqlalchemy-migrate===0.10.0
sqlparse===0.2.1
stevedore===1.17.1
suds-jurko===0.6
sympy===1.0
sysv-ipc===0.7.0
tablib===0.11.2
taskflow===2.6.1
tempest===12.1.0
tempest-lib===1.0.0
tenacity===3.0.0
termcolor===1.1.0
testrepository===0.0.20
testresources===2.0.1
testscenarios===0.5.0
testtools===2.2.0
thriftpy===0.3.9;python_version=='2.7'
tooz===1.43.2
tosca-parser===0.6.0
traceback2===1.4.0
tripleo-common===5.4.4
trollius===2.1
txaio===2.5.1
tzlocal===1.2.2
ujson===1.35
unicodecsv===0.14.1;python_version=='2.7'
unittest2===1.1.0
uritemplate===0.6
urllib3===1.16
virtualenv===15.0.3
voluptuous===0.9.3
waitress===1.0.0
warlock===1.2.0
weakrefmethod===1.0.3;python_version=='2.7'
webcolors===1.5
websocket-client===0.37.0
websockify===0.8.0
wrapt===1.10.8
ws4py===0.3.4
wsgi-intercept===1.3.1
xattr===0.8.0
xmltodict===0.10.2
xvfbwrapper===0.2.8
yaql===1.1.2
zake===0.2.2
zope.interface===4.3.1
virtualbmc===0.1.0