You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
855 B
Python
27 lines
855 B
Python
from __future__ import division
|
|
import unittest
|
|
from monitor import Env, DetailProcess, ProcessCounter
|
|
|
|
class TestMonitorServer(unittest.TestCase):
|
|
|
|
def test_Environment(self):
|
|
"""
|
|
This test case is designed to test the existance of a resource set as an environment variable. This applies to files, folders (not values)
|
|
"""
|
|
p = Env(['PATH','HOME','SHELL'])
|
|
value = p.composite()
|
|
self.assertTrue(value > 0 and value == 2/3)
|
|
self.assertTrue(p.evaluate('PATH') == 0)
|
|
def test_RunningProcess(self):
|
|
p = DetailProcess(['rabbitmq-server','python'])
|
|
r = p.composite()
|
|
print r
|
|
self.assertTrue(r)
|
|
|
|
def test_ProcessCount(self):
|
|
p= ProcessCounter(['apache2','VBoxClient','rabbitmq-server','foo'])
|
|
r = p.composite()
|
|
self.assertTrue( sum(r.values()) > 0 )
|
|
self.assertTrue( r['foo'] == 0)
|
|
if __name__ == '__main__' :
|
|
unittest.main() |