Exemple #1
0
    def test_on_created(self):
        """Tests basic cleanup functionality."""
        watch = cleanup.Cleanup('/does/not/exist', 2)

        watch._on_created('test.yml')

        self.assertEqual(2, treadmill.fs.rm_safe.call_count)
        self.assertEqual(1, shutil.rmtree.call_count)
        self.assertEqual(1, treadmill.spawn.cleanup.Cleanup._nuke.call_count)
Exemple #2
0
    def cleanup_cmd(approot):
        """Spawn cleanup process."""
        watch = cleanup.Cleanup(approot)
        dirwatch = watch.get_dir_watch()

        watch.sync()

        while True:
            if dirwatch.wait_for_events(60):
                dirwatch.process_events()
Exemple #3
0
    def test_sync(self):
        """Tests the initial sync of the manifests."""
        os.listdir.side_effect = [
            ['job1'],
        ]

        watch = cleanup.Cleanup('/does/not/exist', 2)
        watch.sync()

        treadmill.spawn.cleanup.Cleanup._on_created \
                 .assert_called_with('/does/not/exist/cleanup/job1')