yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #03683
[Bug 1179259] Re: test_keystoneclient_sql fails when run by itself
** Changed in: keystone
Status: Fix Committed => Fix Released
** Changed in: keystone
Milestone: None => havana-2
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1179259
Title:
test_keystoneclient_sql fails when run by itself
Status in OpenStack Identity (Keystone):
Fix Released
Bug description:
Commit efc30beab10faf4720a96322adb135726662b025 creates or exposes a problem with
test_keystoneclient_sql so that it doesn't run by itself using sqlite.
(I also tried with mysql and it didn't fail when run by itself.)
These 2 tests in test_keystoneclient_sql.KcMasterSqlTestCase fail:
test_ec2_credentials_delete_user_forbidden
test_ec2_credentials_get_user_forbidden
The error messages are like:
ClientException: An unexpected error prevented the server from fulfilling your request. (OperationalError) no such table: ec2_credential
Note that can run the test by itself but if run test_ec2_credentials_delete_user_forbidden after another ec2 test in
KcMasterSqlTestCase it then fails.
Here's some examples:
./run_tests.sh test_keystoneclient_sql:KcMasterSqlTestCase.test_ec2_credentials_delete_user_forbidden
- WORKS
./run_tests.sh test_keystoneclient_sql:KcMasterSqlTestCase.test_ec2_credentials_get_user_forbidden
- WORKS
./run_tests.sh \
test_keystoneclient_sql:KcMasterSqlTestCase.test_ec2_credentials_delete_user_forbidden \
test_keystoneclient_sql:KcMasterSqlTestCase.test_ec2_credentials_get_user_forbidden
- test_ec2_credentials_delete_user_forbidden WORKS
- test_ec2_credentials_get_user_forbidden FAILS
./run_tests.sh -s \
test_keystoneclient_sql:KcMasterSqlTestCase.test_ec2_credential_crud \
test_keystoneclient_sql:KcMasterSqlTestCase.test_ec2_credentials_delete_user_forbidden
- test_ec2_credential_crud WORKS
- test_ec2_credentials_delete_user_forbidden FAILS
First, for some reason none of the tables appear to be available to the server when running the ec2 test after another test has run. You can query them right after the create_all, but then they dissappear to the ec2 backend. Not sure how this could happen. Maybe a sqlite/sqlalchemy usage problem, or multithreading or timing issue?
Second, it looks like it's possible that sql.ModelBase.metadata.create_all() gets called before all the models are available (have been imported) a this point:
https://github.com/openstack/keystone/blob/master/tests/test_keystoneclient_sql.py#L40
Specifically, the Ec2Token model is in
keystone.contrib.ec2.backends.sql and that's not always imported with
the rest of the models. Maybe the Ec2Token model should be moved into
a common module with the rest of the models so that they're all
imported together.
One thing that should be considered is whether this bit of code is safe:
https://github.com/openstack/keystone/blob/master/keystone/common/sql/core.py#L253
It seems unsafe to implicitly create tables since that should be taken
care of by the tester or keystone-manage.
To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1179259/+subscriptions