diff --git a/utils/test/test-profiles.py b/utils/test/test-profiles.py index 6bc438595..e670c90d3 100644 --- a/utils/test/test-profiles.py +++ b/utils/test/test-profiles.py @@ -9,6 +9,7 @@ # # ------------------------------------------------------------------ +import os import unittest import apparmor.aa as aa @@ -25,12 +26,22 @@ class TestFoo(AATest): def test_active_profiles(self): aa.read_profiles() - self.assertGreaterEqual(len(aa.active_profiles.profile_names), 42) + # when using system apparmor then we haven't necessarily installed all + # the profiles so checking against a specific number may fail - instead + # it is sufficient that profiles were read without an exception being + # thrown above + if os.getenv("USE_SYSTEM", "0") != "1": + self.assertGreaterEqual(len(aa.active_profiles.profile_names), 42) def test_extra_profiles(self): aa.read_inactive_profiles() - self.assertGreaterEqual(len(aa.extra_profiles.profile_names), 100) + # when using system apparmor then we haven't necessarily installed all + # the profiles so checking against a specific number may fail - instead + # it is sufficient that profiles were read without an exception being + # thrown above + if os.getenv("USE_SYSTEM", "0") != "1": + self.assertGreaterEqual(len(aa.extra_profiles.profile_names), 100) setup_aa(aa)