From 8516fc05bac6b9c00ce9d4c605049509c837b466 Mon Sep 17 00:00:00 2001 From: Pranav Date: Tue, 26 May 2020 13:48:44 +0530 Subject: [TestFix] Fix assertItemsEqual issue with python3 Issue: In python3 assertItemsEqual is no longer supported and is replaced with assertCountEqual (Refer [1]). Because of this issue, few arbiter tests are failing. [1] https://docs.python.org/2/library/unittest.html#unittest.TestCase.assertItemsEqual Fix: The replacement assertCountEqual is not supported in python2. So the fix is to replace assertItemsEqual with assertEqual(sorted(expected), sorted(actual)) Change-Id: Ic1d599fa31f85a8a41598b6c245056a6ff01e000 Signed-off-by: Pranav --- .../test_self_heal_50k_files_heal_command_by_add_brick.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/functional/arbiter/test_self_heal_50k_files_heal_command_by_add_brick.py') diff --git a/tests/functional/arbiter/test_self_heal_50k_files_heal_command_by_add_brick.py b/tests/functional/arbiter/test_self_heal_50k_files_heal_command_by_add_brick.py index 06f1f42c0..8b5809cbd 100644 --- a/tests/functional/arbiter/test_self_heal_50k_files_heal_command_by_add_brick.py +++ b/tests/functional/arbiter/test_self_heal_50k_files_heal_command_by_add_brick.py @@ -211,9 +211,10 @@ class TestSelfHeal(GlusterBaseClass): # Checking arequals before bringing bricks online # and after bringing bricks online - self.assertItemsEqual(result_before_online, result_after_online, - 'Checksums before and ' - 'after bringing bricks online are not equal') + self.assertEqual(sorted(result_before_online), + sorted(result_after_online), + 'Checksums before and ' + 'after bringing bricks online are not equal') g.log.info('Checksums before and after bringing bricks online ' 'are equal') @@ -242,8 +243,9 @@ class TestSelfHeal(GlusterBaseClass): # Checking arequals after bringing bricks online # and after adding bricks - self.assertItemsEqual(result_after_online, result_after_adding_bricks, - 'Checksums after bringing bricks online and ' - 'after adding bricks are not equal') + self.assertEqual(sorted(result_after_online), + sorted(result_after_adding_bricks), + 'Checksums after bringing bricks online' + 'and after adding bricks are not equal') g.log.info('Checksums after bringing bricks online and ' 'after adding bricks are equal') -- cgit