Beispiel #1
0
 def test_journald_clean(self):
     if not FileUtilities.exe_exists('journalctl'):
         self.assertRaises(RuntimeError, journald_clean)
     else:
         try:
             journald_clean()
         except RuntimeError as rte:
             # On my system as a regular user, this succeeds.
             # On Travis running Trusty, this worked.
             # On Travis running Xenial, there is a permissions error.
             if common.have_root():
                 raise rte
Beispiel #2
0
    def test_delete_mount_point(self):
        """Unit test for deleting a mount point in use"""
        if not common.have_root():
            self.skipTest('not enough privileges')
        from_dir = os.path.join(self.tempdir, 'mount_from')
        to_dir = os.path.join(self.tempdir, 'mount_to')
        os.mkdir(from_dir)
        os.mkdir(to_dir)
        args = ['mount', '--bind', from_dir, to_dir]
        (rc, stdout, stderr) = run_external(args)
        msg = 'error calling mount\nargs=%s\nstderr=%s' % (args, stderr)
        self.assertEqual(rc, 0, msg)

        delete(to_dir)

        args = ['umount', to_dir]
        (rc, stdout, stderr) = run_external(args)
        msg = 'error calling umount\nargs=%s\nstderr=%s' % (args, stderr)
        self.assertEqual(rc, 0, msg)
Beispiel #3
0
 def test_swap_off_swap_on(self):
     """Test for disabling and enabling swap"""
     if not common.have_root():
         self.skipTest('not enough privileges')
     disable_swap_linux()
     enable_swap_linux()