Esempio n. 1
0
 def testBadPidFile(self):
     pid_dir = "/does-not-exist"
     pid_file = getPidFile(pid_dir)
     self.assertEquals(pid_file, "/tmp/dd-agent.pid")
     pid = "666"
     pid_f = open(pid_file, 'w')
     pid_f.write(pid)
     pid_f.close()
     self.assertEquals(getPid(pid_dir), 666)
     self.assertEquals(cleanPidFile(pid_dir), True)
     self.assertEquals(os.path.exists(pid_file), False)
Esempio n. 2
0
 def testGoodPidFie(self):
     """Verify that the pid file succeeds and fails appropriately"""
     # Pidfile always writable
     pid_dir = tempfile.mkdtemp()
     pid_file = getPidFile(pid_dir)
     pid = "666"
     pid_f = open(pid_file, 'w')
     pid_f.write(pid)
     pid_f.close()
     self.assertEquals(getPid(pid_dir), 666)
     # clean up
     self.assertEquals(cleanPidFile(pid_dir), True)
     self.assertEquals(os.path.exists(pid_file), False)