Skip to content

utils/tests: test-include.py sometimes fails due to ordering

Steve Beattie requested to merge smb/apparmor:utils-test-include-ordering into master

With the includes rule class landing, this particular test failed in a test vm due to the sort ordering being different. It's not clear that there should be an expectation of ordering returned from get_full_paths(), so sort the result.

Signed-off-by: Steve Beattie steve.beattie@canonical.com

Example failure:

=== test-include.py ===
................F..................................................................
======================================================================
FAIL: test_2 (__main__.IncludeFullPathsTest)
test 'include <abstractions/inc.d>'
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/apparmor/utils/test/common_test.py", line 88, in stub_test
    self._run_test(test_data, expected)
  File "test-include.py", line 379, in _run_test
    self.assertEqual(obj.get_full_paths(self.profile_dir), exp2)
AssertionError: Lists differ: ['/tm[45 chars]d/incbar', '/tmp/aa-test-0w0rne1d/profiles/abs[19 chars]foo'] != ['/tm[45 chars]d/incfoo', '/tmp/aa-test-0w0rne1
d/profiles/abs[19 chars]bar']

First differing element 0:
'/tmp/aa-test-0w0rne1d/profiles/abstractions/inc.d/incbar'
'/tmp/aa-test-0w0rne1d/profiles/abstractions/inc.d/incfoo'

- ['/tmp/aa-test-0w0rne1d/profiles/abstractions/inc.d/incbar',
-  '/tmp/aa-test-0w0rne1d/profiles/abstractions/inc.d/incfoo']
? ^                                                          ^

+ ['/tmp/aa-test-0w0rne1d/profiles/abstractions/inc.d/incfoo',
? ^                                                          ^

+  '/tmp/aa-test-0w0rne1d/profiles/abstractions/inc.d/incbar']

----------------------------------------------------------------------
Edited by Steve Beattie

Merge request reports