diff --git a/manila/network/linux/ip_lib.py b/manila/network/linux/ip_lib.py
index d8f5b01633..ad5c077550 100644
--- a/manila/network/linux/ip_lib.py
+++ b/manila/network/linux/ip_lib.py
@@ -394,8 +394,8 @@ class IpNetnsCommand(IpCommandBase):
else:
env_params = []
if addl_env:
- env_params = (['env'] +
- ['%s=%s' % pair for pair in addl_env.items()])
+ env_params = (['env'] + ['%s=%s' % pair
+ for pair in sorted(addl_env.items())])
total_cmd = (['ip', 'netns', 'exec', self._parent.namespace] +
env_params + list(cmds))
return utils.execute(*total_cmd, run_as_root=True,
diff --git a/manila/share/drivers/glusterfs.py b/manila/share/drivers/glusterfs.py
index f79e3cca17..5e8f9c09dc 100644
--- a/manila/share/drivers/glusterfs.py
+++ b/manila/share/drivers/glusterfs.py
@@ -336,8 +336,8 @@ class GlusterfsShareDriver(driver.ExecuteMixin, driver.ShareDriver):
return
if export_dir_dict:
- export_dir_new = ",".join("/%s(%s)" % (d, "|".join(v))
- for d, v in export_dir_dict.items())
+ export_dir_new = (",".join("/%s(%s)" % (d, "|".join(v))
+ for d, v in sorted(export_dir_dict.items())))
args, kw = self.gluster_address.make_gluster_args(
'volume', 'set', self.gluster_address.volume,
NFS_EXPORT_DIR, export_dir_new)
diff --git a/manila/share/drivers/netapp/cluster_mode.py b/manila/share/drivers/netapp/cluster_mode.py
index 5f70a4bcfc..6fa8cb9b08 100644
--- a/manila/share/drivers/netapp/cluster_mode.py
+++ b/manila/share/drivers/netapp/cluster_mode.py
@@ -162,10 +162,10 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
except naapi.NaApiError as e:
LOG.error(_("Could not get licenses list. %s.") % e)
else:
- self._licenses = [
+ self._licenses = sorted([
l.get_child_content('package').lower()
for l in licenses.get_child_by_name('licenses').get_children()
- ]
+ ])
log_data = {
'backend': self.backend_name,
'licenses': ', '.join(self._licenses),
diff --git a/manila/tests/api/middleware/test_faults.py b/manila/tests/api/middleware/test_faults.py
index 03b73541af..97cd2a5a02 100644
--- a/manila/tests/api/middleware/test_faults.py
+++ b/manila/tests/api/middleware/test_faults.py
@@ -173,16 +173,24 @@ class FaultsXMLSerializationTestV11(test.TestCase):
}
output = serializer.serialize(fixture)
- actual = minidom.parseString(self._prepare_xml(output))
+ result = minidom.parseString(self._prepare_xml(output))
- expected = minidom.parseString(self._prepare_xml("""
-
- sorry
- 4
-
- """) % common.XML_NS_V1)
+ # result has 1 child - overLimit
+ self.assertEqual(result.firstChild, result.lastChild)
+ self.assertEqual(result.firstChild.tagName, 'overLimit')
- self.assertEqual(expected.toxml(), actual.toxml())
+ # overLimit has attrs code = '413' and xmlns = common.XML_NS_V1
+ self.assertEqual(result.firstChild.getAttribute('code'), '413')
+ self.assertEqual(result.firstChild.getAttribute('xmlns'),
+ common.XML_NS_V1)
+
+ # overLimit has childs message = 'sorry' and retryAfter = '4'
+ message = result.firstChild.getElementsByTagName('message')
+ retry_after = result.firstChild.getElementsByTagName('retryAfter')
+ self.assertEqual(len(message), 1)
+ self.assertEqual(len(retry_after), 1)
+ self.assertEqual(message[0].toxml(), 'sorry')
+ self.assertEqual(retry_after[0].toxml(), '4')
def test_404_fault(self):
metadata = {'attributes': {"itemNotFound": 'code'}}
diff --git a/manila/tests/api/test_xmlutil.py b/manila/tests/api/test_xmlutil.py
index 87e42ae537..271bb1df4c 100644
--- a/manila/tests/api/test_xmlutil.py
+++ b/manila/tests/api/test_xmlutil.py
@@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from xml.dom import minidom
+
from lxml import etree
from manila.api import xmlutil
@@ -689,9 +691,26 @@ class TemplateBuilderTest(test.TestCase):
class MiscellaneousXMLUtilTests(test.TestCase):
def test_make_flat_dict(self):
- expected_xml = ("\n"
- 'foobar')
+ expected = minidom.parseString(
+ ""
+ "foobar"
+ )
root = xmlutil.make_flat_dict('wrapper')
tmpl = xmlutil.MasterTemplate(root, 1)
result = tmpl.serialize(dict(wrapper=dict(a='foo', b='bar')))
- self.assertEqual(result, expected_xml)
+ actual = minidom.parseString(result)
+
+ self.assertEqual(expected.firstChild.tagName,
+ actual.firstChild.tagName)
+ expected_child_a = expected.firstChild.getElementsByTagName('a')
+ expected_child_b = expected.firstChild.getElementsByTagName('b')
+ actual_child_a = actual.firstChild.getElementsByTagName('a')
+ actual_child_b = actual.firstChild.getElementsByTagName('b')
+ self.assertEqual(len(expected_child_a), 1)
+ self.assertEqual(len(expected_child_b), 1)
+ self.assertEqual(len(actual_child_a), 1)
+ self.assertEqual(len(actual_child_b), 1)
+ self.assertEqual(expected_child_a[0].toxml(),
+ actual_child_a[0].toxml())
+ self.assertEqual(expected_child_b[0].toxml(),
+ actual_child_b[0].toxml())
diff --git a/manila/tests/network/linux/test_ip_lib.py b/manila/tests/network/linux/test_ip_lib.py
index 03562fda48..6b1985695f 100644
--- a/manila/tests/network/linux/test_ip_lib.py
+++ b/manila/tests/network/linux/test_ip_lib.py
@@ -665,7 +665,7 @@ class TestIpNetnsCommand(TestIPCmdBase):
env = dict(FOO=1, BAR=2)
self.netns_cmd.execute(['ip', 'link', 'list'], env)
execute.assert_called_once_with(
- 'ip', 'netns', 'exec', 'ns', 'env', 'FOO=1', 'BAR=2',
+ 'ip', 'netns', 'exec', 'ns', 'env', 'BAR=2', 'FOO=1',
'ip', 'link', 'list',
run_as_root=True, check_exit_code=True)
diff --git a/tox.ini b/tox.ini
index 21659ae327..21bd400250 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,8 +5,6 @@ envlist = py26,py27,pep8
[testenv]
setenv = VIRTUAL_ENV={envdir}
- # NOTE (viktors): Workaround for bug 1359982
- PYTHONHASHSEED=0
usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/requirements.txt