Compare commits
3 Commits
nilmrun-1.
...
nilmrun-1.
Author | SHA1 | Date | |
---|---|---|---|
7f05a0fb62 | |||
81c2ad07d4 | |||
3588e843ac |
@@ -352,8 +352,8 @@ class TestClient(object):
|
||||
# start some processes
|
||||
a = client.post("run/command", { "argv": ["sleep","60"] } )
|
||||
b = client.post("run/command", { "argv": ["sh","-c","sleep 2;true"] } )
|
||||
c = client.post("run/command", { "argv": ["sh","-c","burnP5;true"] } )
|
||||
d = client.post("run/command", { "argv": ["burnP5" ] } )
|
||||
c = client.post("run/command", { "argv": ["sh","-c","dd if=/dev/zero of=/dev/null;true"] } )
|
||||
d = client.post("run/command", { "argv": ["dd", "if=/dev/zero", "of=/dev/null" ] } )
|
||||
|
||||
info = client.get("process/info")
|
||||
eq_(info["pids"][a]["procs"], 1)
|
||||
@@ -365,9 +365,13 @@ class TestClient(object):
|
||||
lt_(20, info["pids"][c]["cpu_percent"])
|
||||
lt_(80, info["system"]["cpu_percent"])
|
||||
|
||||
time.sleep(2)
|
||||
info = client.get("process/info")
|
||||
eq_(info["pids"][b]["procs"], 0)
|
||||
for x in range(10):
|
||||
time.sleep(1)
|
||||
info = client.get("process/info")
|
||||
if info["pids"][b]["procs"] != 2:
|
||||
break
|
||||
else:
|
||||
raise Exception("process B didn't die: " + str(info["pids"][b]))
|
||||
|
||||
# kill all processes
|
||||
for pid in client.get("process/list"):
|
||||
@@ -377,7 +381,7 @@ class TestClient(object):
|
||||
client = HTTPClient(baseurl = testurl, post_json = True)
|
||||
eq_(client.get("process/list"), [])
|
||||
def verify(cmd, result):
|
||||
pid = client.post("run/command", { "argv": [ "sh", "-c", cmd ] })
|
||||
pid = client.post("run/command", { "argv": [ "/bin/bash", "-c", cmd ] })
|
||||
eq_(client.get("process/list"), [pid])
|
||||
status = self.wait_end(client, pid)
|
||||
eq_(result, status["log"])
|
||||
|
Reference in New Issue
Block a user