Esempio n. 1
0
 def test_missing_status(self):
     """Create a results dir w/o STATUS and confirm it is set to FAILED"""
     uuid = str(uuid4())
     os.makedirs(joinpaths(self.monitor_cfg.composer_dir, "results", uuid))
     check_queues(self.monitor_cfg)
     status = open(joinpaths(self.monitor_cfg.composer_dir, "results", uuid, "STATUS")).read().strip()
     self.assertEqual(status, "FAILED")
Esempio n. 2
0
 def test_running_status(self):
     """Create a results dir with STATUS set to RUNNING and confirm it is set to FAILED"""
     uuid = str(uuid4())
     os.makedirs(joinpaths(self.monitor_cfg.composer_dir, "results", uuid))
     open(joinpaths(self.monitor_cfg.composer_dir, "results", uuid, "STATUS"), "w").write("RUNNING\n")
     check_queues(self.monitor_cfg)
     status = open(joinpaths(self.monitor_cfg.composer_dir, "results", uuid, "STATUS")).read().strip()
     self.assertEqual(status, "FAILED")
Esempio n. 3
0
 def test_broken_new_symlinks(self):
     """Put a broken symlink into queue/new and make sure it is removed"""
     uuid = str(uuid4())
     os.symlink(joinpaths(self.monitor_cfg.composer_dir, "results", uuid),
                joinpaths(self.monitor_cfg.composer_dir, "queue/new", uuid))
     self.assertTrue(os.path.islink(joinpaths(self.monitor_cfg.composer_dir, "queue/new", uuid)))
     check_queues(self.monitor_cfg)
     self.assertFalse(os.path.islink(joinpaths(self.monitor_cfg.composer_dir, "queue/new", uuid)))
Esempio n. 4
0
 def test_missing_new_symlink(self):
     """Create a results dir with STATUS set to WAITING and confirm a symlink is created in queue/new"""
     uuid = str(uuid4())
     os.makedirs(joinpaths(self.monitor_cfg.composer_dir, "results", uuid))
     open(joinpaths(self.monitor_cfg.composer_dir, "results", uuid, "STATUS"), "w").write("WAITING\n")
     check_queues(self.monitor_cfg)
     status = open(joinpaths(self.monitor_cfg.composer_dir, "results", uuid, "STATUS")).read().strip()
     self.assertEqual(status, "WAITING")
     self.assertTrue(os.path.islink(joinpaths(self.monitor_cfg.composer_dir, "queue/new", uuid)))
Esempio n. 5
0
 def test_stale_run_symlink(self):
     """Put a valid symlink in run, make sure it is set to FAILED and removed"""
     uuid = str(uuid4())
     os.makedirs(joinpaths(self.monitor_cfg.composer_dir, "results", uuid))
     os.symlink(joinpaths(self.monitor_cfg.composer_dir, "results", uuid),
                joinpaths(self.monitor_cfg.composer_dir, "queue/run", uuid))
     self.assertTrue(os.path.islink(joinpaths(self.monitor_cfg.composer_dir, "queue/run", uuid)))
     check_queues(self.monitor_cfg)
     self.assertFalse(os.path.islink(joinpaths(self.monitor_cfg.composer_dir, "queue/run", uuid)))
     status = open(joinpaths(self.monitor_cfg.composer_dir, "results", uuid, "STATUS")).read().strip()
     self.assertEqual(status, "FAILED")