|
|
@@ -291,22 +291,32 @@ class TestClient(object): |
|
|
|
">= end time 1332511201000000", str(e.exception)) |
|
|
|
is not None) |
|
|
|
|
|
|
|
def check_data(): |
|
|
|
# Verify the intervals. Should be just one, even if the data |
|
|
|
# was inserted in chunks, due to nilmdb interval concatenation. |
|
|
|
intervals = list(client.stream_intervals("/newton/prep")) |
|
|
|
eq_(intervals, [[start, start + 119999777]]) |
|
|
|
|
|
|
|
# Try some overlapping data -- just insert it again |
|
|
|
data = timestamper.TimestamperRate(testfile, start, 120) |
|
|
|
with assert_raises(ClientError) as e: |
|
|
|
result = client.stream_insert("/newton/prep", data) |
|
|
|
in_("400 Bad Request", str(e.exception)) |
|
|
|
in_("verlap", str(e.exception)) |
|
|
|
|
|
|
|
# Now do the real load |
|
|
|
data = timestamper.TimestamperRate(testfile, start, 120) |
|
|
|
result = client.stream_insert("/newton/prep", data, |
|
|
|
start, start + 119999777) |
|
|
|
check_data() |
|
|
|
|
|
|
|
# Verify the intervals. Should be just one, even if the data |
|
|
|
# was inserted in chunks, due to nilmdb interval concatenation. |
|
|
|
intervals = list(client.stream_intervals("/newton/prep")) |
|
|
|
eq_(intervals, [[start, start + 119999777]]) |
|
|
|
|
|
|
|
# Try some overlapping data -- just insert it again |
|
|
|
# Try inserting directly-passed data |
|
|
|
client.stream_remove("/newton/prep", start, start + 119999777) |
|
|
|
data = timestamper.TimestamperRate(testfile, start, 120) |
|
|
|
with assert_raises(ClientError) as e: |
|
|
|
result = client.stream_insert("/newton/prep", data) |
|
|
|
in_("400 Bad Request", str(e.exception)) |
|
|
|
in_("verlap", str(e.exception)) |
|
|
|
data_bytes = b''.join(data) |
|
|
|
result = client.stream_insert("/newton/prep", data_bytes, |
|
|
|
start, start + 119999777) |
|
|
|
check_data() |
|
|
|
|
|
|
|
nilmdb.client.client.StreamInserter._max_data = old_max_data |
|
|
|
client.close() |
|
|
|