|
@@ -98,7 +98,7 @@ class TestClient(object): |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
|
|
|
|
|
|
# start dummy filter |
|
|
# start dummy filter |
|
|
pid = client.post("/run/dummy", { "data": 30 }) |
|
|
|
|
|
|
|
|
pid = client.post("/run/testfilter", { "data": 30 }) |
|
|
eq_(client.get("/process/list"), [pid]) |
|
|
eq_(client.get("/process/list"), [pid]) |
|
|
time.sleep(1) |
|
|
time.sleep(1) |
|
|
|
|
|
|
|
@@ -132,7 +132,7 @@ class TestClient(object): |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
|
|
|
|
|
|
# Trigger exception in filter |
|
|
# Trigger exception in filter |
|
|
pid = client.post("/run/dummy", { "data": -1 }) |
|
|
|
|
|
|
|
|
pid = client.post("/run/testfilter", { "data": -1 }) |
|
|
time.sleep(0.5) |
|
|
time.sleep(0.5) |
|
|
status = client.get("/process/status", { "pid": pid }) |
|
|
status = client.get("/process/status", { "pid": pid }) |
|
|
eq_(status["alive"], False) |
|
|
eq_(status["alive"], False) |
|
@@ -141,7 +141,7 @@ class TestClient(object): |
|
|
client.post("/process/remove", { "pid": pid }) |
|
|
client.post("/process/remove", { "pid": pid }) |
|
|
|
|
|
|
|
|
# Kill a running filter by removing it early |
|
|
# Kill a running filter by removing it early |
|
|
newpid = client.post("/run/dummy", { "data": 50 }) |
|
|
|
|
|
|
|
|
newpid = client.post("/run/testfilter", { "data": 50 }) |
|
|
ne_(newpid, pid) |
|
|
ne_(newpid, pid) |
|
|
time.sleep(0.5) |
|
|
time.sleep(0.5) |
|
|
start = time.time() |
|
|
start = time.time() |
|
@@ -156,7 +156,7 @@ class TestClient(object): |
|
|
eq_(client.get("/process/list"), []) |
|
|
eq_(client.get("/process/list"), []) |
|
|
|
|
|
|
|
|
# Try to remove a running filter that ignored SIGTERM |
|
|
# Try to remove a running filter that ignored SIGTERM |
|
|
pid = client.post("/run/dummy", { "data": 0 }) |
|
|
|
|
|
|
|
|
pid = client.post("/run/testfilter", { "data": 0 }) |
|
|
start = time.time() |
|
|
start = time.time() |
|
|
status = client.post("/process/remove", { "pid": pid }) |
|
|
status = client.post("/process/remove", { "pid": pid }) |
|
|
elapsed = time.time() - start |
|
|
elapsed = time.time() - start |
|
@@ -165,6 +165,7 @@ class TestClient(object): |
|
|
eq_(status["alive"], False) |
|
|
eq_(status["alive"], False) |
|
|
ne_(status["exitcode"], 0) |
|
|
ne_(status["exitcode"], 0) |
|
|
|
|
|
|
|
|
|
|
|
@unittest.skip("trainola moving to nilmtools") |
|
|
def test_client_05_trainola_simple(self): |
|
|
def test_client_05_trainola_simple(self): |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
pid = client.post("/run/trainola", { "data": {} }) |
|
|
pid = client.post("/run/trainola", { "data": {} }) |
|
@@ -172,7 +173,7 @@ class TestClient(object): |
|
|
ne_(status["exitcode"], 0) |
|
|
ne_(status["exitcode"], 0) |
|
|
status = client.post("/process/remove", { "pid": pid }) |
|
|
status = client.post("/process/remove", { "pid": pid }) |
|
|
|
|
|
|
|
|
@unittest.skip("needs a running nilmdb") |
|
|
|
|
|
|
|
|
@unittest.skip("needs a running nilmdb; trainola moved to nilmtools") |
|
|
def test_client_06_trainola(self): |
|
|
def test_client_06_trainola(self): |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
client = HTTPClient(baseurl = testurl, post_json = True) |
|
|
|
|
|
|