[apparmor] [patch] various fixes for minitools_test.py

Seth Arnold seth.arnold at canonical.com
Mon Sep 15 22:12:53 UTC 2014


On Sun, Sep 14, 2014 at 12:31:49AM +0200, Christian Boltz wrote:
> Hello,
> 
> this patch contains various fixes for utils/test/minitools_test.py:
> - test_audit: fix error message
> - test_complain: replace "aa-complain -r" with aa-enforce (we removed 
>   the -r flag from aa-complain)
> - test_complain: disable checks for force-complain symlinks, 
>   aa-complain doesn't create them

NAK, aa-enforce should remove the force-complain syslink and we need
to continue testing this to ensure it works. I'm fine with dropping the
aa-complain test of force-complain, since the tool can't be expected to
pass without further development, but aa-enforce should work now.

Thanks

> 
> 
> === modified file 'utils/test/minitools_test.py'
> --- utils/test/minitools_test.py        2014-07-17 13:59:57 +0000
> +++ utils/test/minitools_test.py        2014-09-13 22:24:43 +0000
> @@ -41,18 +41,18 @@
>          #Remove audit mode from ntpd profile and check if it was correctly removed
>          subprocess.check_output('%s ./../aa-audit -d ./profiles -r %s'%(python_interpreter, test_path), shell=True)
>  
> -        self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), None, 'Complain flag could not be removed in profile %s'%local_profilename)
> +        self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), None, 'Audit flag could not be removed in profile %s'%local_profilename)
>  
>  
>      def test_complain(self):
>          #Set ntpd profile to complain mode and check if it was correctly set
>          subprocess.check_output('%s ./../aa-complain -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>  
> -        self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
> +#        self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
>          self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), 'complain', 'Complain flag could not be set in profile %s'%local_profilename)
>  
>          #Set ntpd profile to enforce mode and check if it was correctly set
> -        subprocess.check_output('%s ./../aa-complain -d ./profiles -r %s'%(python_interpreter, test_path), shell=True)
> +        subprocess.check_output('%s ./../aa-enforce -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>  
>          self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from force-complain'%local_profilename)
>          self.assertEqual(os.path.islink('./profiles/disable/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from disable'%local_profilename)
> @@ -62,11 +62,11 @@
>          subprocess.check_output('%s ./../aa-audit -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>          subprocess.check_output('%s ./../aa-complain -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>  
> -        self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
> +#        self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
>          self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), 'audit,complain', 'Complain flag could not be set in profile %s'%local_profilename)
>  
>          #Remove complain flag first i.e. set to enforce mode
> -        subprocess.check_output('%s ./../aa-complain -d ./profiles -r %s'%(python_interpreter, test_path), shell=True)
> +        subprocess.check_output('%s ./../aa-enforce -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>  
>          self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from force-complain'%local_profilename)
>          self.assertEqual(os.path.islink('./profiles/disable/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from disable'%local_profilename)
> 
> 
> 
> Regards,
> 
> Christian Boltz
> -- 
> "Theory and practice sometimes clash. And when that happens,
> theory loses. Every single time."         -- Linus Torvalds
> 
> 
> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140915/1c6240c5/attachment.pgp>


More information about the AppArmor mailing list