Sort by dict key in order to make the test deterministic

Change-Id: I34e95e7dde4049c2f85dd1efe37ab77e5837d045
This commit is contained in:
Weidong Shao 2014-08-07 10:34:38 +00:00
parent c5b2c92dfd
commit a431d34202
3 changed files with 7 additions and 7 deletions

View File

@ -101,7 +101,7 @@ class BaseInstaller(object):
raise KeyError("'%s' is an invalid metadata!" % key) raise KeyError("'%s' is an invalid metadata!" % key)
def _get_tmpl_vars_helper(self, metadata, config, output): def _get_tmpl_vars_helper(self, metadata, config, output):
for key, config_value in config.iteritems(): for key, config_value in sorted(config.iteritems()):
is_regular_key, sub_meta = self._get_submeta_by_key(metadata, key) is_regular_key, sub_meta = self._get_submeta_by_key(metadata, key)
mapping_to = self._get_key_mapping(sub_meta, key, is_regular_key) mapping_to = self._get_key_mapping(sub_meta, key, is_regular_key)

View File

@ -65,10 +65,6 @@ class TestCobblerInstaller(unittest2.TestCase):
} }
}, },
"partition": { "partition": {
"/var": {
"vol_size": 30,
"vol_percentage": 30
},
"/home": { "/home": {
"vol_size": 50, "vol_size": 50,
"vol_percentage": 40 "vol_percentage": 40
@ -76,6 +72,10 @@ class TestCobblerInstaller(unittest2.TestCase):
"/test": { "/test": {
"vol_size": 10, "vol_size": 10,
"vol_percentage": 10 "vol_percentage": 10
},
"/var": {
"vol_size": 30,
"vol_percentage": 30
} }
}, },
"server_credentials": { "server_credentials": {
@ -148,7 +148,7 @@ class TestCobblerInstaller(unittest2.TestCase):
"ksmeta": { "ksmeta": {
"promisc_nics": "", "promisc_nics": "",
"timezone": "UTC", "timezone": "UTC",
"partition": "/test 10%;/var 30%;/home 40%", "partition": "/home 40%;/test 10%;/var 30%",
"https_proxy": "", "https_proxy": "",
"ntp_server": "127.0.0.1", "ntp_server": "127.0.0.1",
"chef_url": "https://127.0.0.1", "chef_url": "https://127.0.0.1",

View File

@ -38,7 +38,7 @@
, ,
"ksmeta":{ "ksmeta":{
#set partition_config = '' #set partition_config = ''
#for k, v in $host.partition.iteritems(): #for k, v in sorted($host.partition.iteritems()):
#set path = '' #set path = ''
#if v['vol_percentage']: #if v['vol_percentage']:
#set $path = k + ' ' + str(v['vol_percentage']) + '%' #set $path = k + ' ' + str(v['vol_percentage']) + '%'