Navigation Menu

Skip to content

Commit

Permalink
Fix MySQL charset error.
Browse files Browse the repository at this point in the history
If using MySQL, there's a bug with the charset setting which is declared as
a variable whereas it should be a string. This fixes bug #1092856 and adds
a test for this.

Change-Id: I76e19e2dd86f920aa7c9f792da7057d42ed3e9c9
  • Loading branch information
Brooklyn Chen committed Dec 25, 2012
1 parent 29f5eda commit 1ae26a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ceilometer/storage/sqlalchemy/models.py
Expand Up @@ -42,7 +42,7 @@ def table_args():
engine_name = urlparse(cfg.CONF.database_connection).scheme
if engine_name == 'mysql':
return {'mysql_engine': cfg.CONF.mysql_engine,
'mysql_charset': utf8}
'mysql_charset': "utf8"}
return None


Expand Down
9 changes: 7 additions & 2 deletions tests/storage/test_impl_sqlalchemy.py
Expand Up @@ -28,8 +28,8 @@
from ceilometer import storage
from ceilometer.openstack.common import cfg
from ceilometer.storage import impl_sqlalchemy
from ceilometer.storage.sqlalchemy.models import Meter, Project, Resource
from ceilometer.storage.sqlalchemy.models import User
from ceilometer.storage.sqlalchemy.models import Meter, Project, Resource, User
from ceilometer.storage.sqlalchemy.models import table_args


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -721,3 +721,8 @@ def test_start_end_timestamp(self):

results = list(self.conn.get_volume_max(f))
assert results == expected


def test_model_table_args():
cfg.CONF.database_connection = 'mysql://localhost'
assert table_args()

0 comments on commit 1ae26a4

Please sign in to comment.