Fix intermittent test failures because of sort order

Both py27 and py34 jobs fail intermittently and i can
recreate the problem even in my local environment by
repeatedly running "tox -e py27,py34". Fixing up the
sort order helps fix the this issue.

Change-Id: I680c8e986af9177c759740ecb8b94b288386c1bf
This commit is contained in:
Davanum Srinivas 2015-06-19 15:40:12 -04:00
parent 6bfdb33cc9
commit 7a6ccda607
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ class BasicKeyValueView(object):
""" """
def __call__(self, model): def __call__(self, model):
res = utils.StringWithAttrs(json.dumps(model.data)) res = utils.StringWithAttrs(json.dumps(model.data, sort_keys=True))
res.__is_json__ = True res.__is_json__ = True
return res return res

View File

@ -35,7 +35,7 @@ class MultiView(object):
""" """
def __call__(self, model): def __call__(self, model):
res = [six.text_type(model[key]) for key in model] res = sorted([six.text_type(model[key]) for key in model])
return "\n".join(res) return "\n".join(res)
@ -49,7 +49,7 @@ class BasicKeyValueView(object):
def __call__(self, model): def __call__(self, model):
res = "" res = ""
for key in model: for key in sorted(model):
res += "{key} = {value}\n".format(key=key, value=model[key]) res += "{key} = {value}\n".format(key=key, value=model[key])
return res return res