test cases and requirements

master
Steve L. Nyemba 8 years ago
parent b0cd031b07
commit cd81534d78

@ -1,13 +1,20 @@
aniso8601==1.2.0
click==6.6 click==6.6
couchdbkit==0.6.5 couchdbkit==0.6.5
Flask==0.11.1 Flask==0.11.1
Flask-Session==0.3.0 Flask-Session==0.3.0
Flask-SocketIO==2.8.2
http-parser==0.8.3 http-parser==0.8.3
itsdangerous==0.24 itsdangerous==0.24
Jinja2==2.8 Jinja2==2.8
MarkupSafe==0.23 MarkupSafe==0.23
numpy==1.11.3 numpy==1.11.3
pika==0.10.0 pika==0.10.0
python-dateutil==2.6.0
python-engineio==1.1.0
python-socketio==1.6.2
pytz==2016.10
restkit==4.2.2 restkit==4.2.2
six==1.10.0
socketpool==0.5.3 socketpool==0.5.3
Werkzeug==0.11.11 Werkzeug==0.11.11

Binary file not shown.

@ -3,6 +3,14 @@ import unittest
from monitor import Env, DetailProcess, ProcessCounter, Sandbox from monitor import Env, DetailProcess, ProcessCounter, Sandbox
import monitor import monitor
import os import os
import json
from utils.workers import Top, Learner
from multiprocessing import Lock
path = os.environ['MONITOR_CONFIG_PATH']
f = open(path)
CONFIG = json.loads( f.read())
f.close()
class TestMonitorServer(unittest.TestCase): class TestMonitorServer(unittest.TestCase):
def test_Environment(self): def test_Environment(self):
@ -14,7 +22,7 @@ class TestMonitorServer(unittest.TestCase):
r = p.composite() r = p.composite()
value = r['value'] value = r['value']
self.assertTrue(value > 0 and value == 2/3) self.assertTrue(value > 0 and value >= (100*2/3),value)
self.assertTrue(p.evaluate('PATH') == 0) self.assertTrue(p.evaluate('PATH') == 0)
def test_RunningProcess(self): def test_RunningProcess(self):
p = DetailProcess() p = DetailProcess()
@ -35,28 +43,10 @@ class TestMonitorServer(unittest.TestCase):
p = Sandbox() p = Sandbox()
p.init({"sandbox":sandbox_path,"requirements":requirements_path}) p.init({"sandbox":sandbox_path,"requirements":requirements_path})
p.composite() p.composite()
def test_map(self): def test_StartTop(self):
p = DetailProcess() lock = Lock()
p.init(['rabbitmq-server','python','apache2']) p = Top(CONFIG,lock)
r ={"test": p.composite()} p.start()
logs = [r,{"x-test":p.composite()}] p.join()
key = "test"
id = "memory_usage"
def mapper(row,emit):
[emit(item['label'],item) for item in row ]
def reducer(values):
end = len(values)-1
beg = 0 if end < 100 else end - 100
return values[beg:]
#def reducer(values):
mrh = monitor.mapreducer()
logs = mrh.filter('test',logs)
print mrh.run(logs,mapper,None)
if __name__ == '__main__' : if __name__ == '__main__' :
unittest.main() unittest.main()

Loading…
Cancel
Save