Resolving "localhost" may either return "127.0.0.1" or "::1", so we have to check for both cases in the relevant tests.
Signed-off-by: Apollon Oikonomopoulos <[email protected]> --- test/py/ganeti.storage.gluster_unittest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/py/ganeti.storage.gluster_unittest.py b/test/py/ganeti.storage.gluster_unittest.py index 2037eac..f19c212 100644 --- a/test/py/ganeti.storage.gluster_unittest.py +++ b/test/py/ganeti.storage.gluster_unittest.py @@ -65,7 +65,7 @@ class TestGlusterVolume(testutils.GanetiTestCase): def testHostnameResolution(self): vol_1 = TestGlusterVolume._MakeVolume(addr="localhost") - self.assertEqual(vol_1.server_ip, "127.0.0.1") + self.assertIn(vol_1.server_ip, ("127.0.0.1", "::1")) self.assertRaises(errors.ResolverError, lambda: \ TestGlusterVolume._MakeVolume(addr="E_NOENT")) @@ -95,9 +95,10 @@ class TestGlusterVolume(testutils.GanetiTestCase): vol_3 = TestGlusterVolume._MakeVolume(addr="localhost", port=9001, vol_name="testvol") - self.assertEqual( + self.assertIn( vol_3.GetKVMMountString("dir/a.img"), - "gluster://127.0.0.1:9001/testvol/dir/a.img" + ("gluster://127.0.0.1:9001/testvol/dir/a.img", + "gluster://[::1]:9001/testvol/dir/a.img") ) def testFUSEMountStrings(self): @@ -121,9 +122,9 @@ class TestGlusterVolume(testutils.GanetiTestCase): vol_3 = TestGlusterVolume._MakeVolume(addr="localhost", port=9001, vol_name="testvol") - self.assertEqual( + self.assertIn( vol_3._GetFUSEMountString(), - "127.0.0.1:9001:testvol" + ("127.0.0.1:9001:testvol", "::1:9001:testvol") ) -- 1.9.2
