|
|
@@ -21,13 +21,17 @@ from testutil.helpers import * |
|
|
|
|
|
|
|
testdb = "tests/cmdline-testdb" |
|
|
|
|
|
|
|
def server_start(max_results = None, max_removals = None, bulkdata_args = {}): |
|
|
|
def server_start(max_results = None, |
|
|
|
max_removals = None, |
|
|
|
max_int_removals = None, |
|
|
|
bulkdata_args = {}): |
|
|
|
global test_server, test_db |
|
|
|
# Start web app on a custom port |
|
|
|
test_db = nilmdb.utils.serializer_proxy(nilmdb.server.NilmDB)( |
|
|
|
testdb, |
|
|
|
max_results = max_results, |
|
|
|
max_removals = max_removals, |
|
|
|
max_int_removals = max_int_removals, |
|
|
|
bulkdata_args = bulkdata_args) |
|
|
|
test_server = nilmdb.server.Server(test_db, host = "127.0.0.1", |
|
|
|
port = 32180, stoppable = False, |
|
|
@@ -880,14 +884,26 @@ class TestCmdline(object): |
|
|
|
self.ok("destroy -R /newton/prep") # destroy again |
|
|
|
|
|
|
|
def test_14_remove_files(self): |
|
|
|
# Test BulkData's ability to remove when data is split into |
|
|
|
# multiple files. Should be a fairly comprehensive test of |
|
|
|
# remove functionality. |
|
|
|
# Also limit max_removals, to cover more functionality. |
|
|
|
# Limit max_removals, to cover more functionality. |
|
|
|
server_stop() |
|
|
|
server_start(max_removals = 4321, |
|
|
|
bulkdata_args = { "file_size" : 920, # 23 rows per file |
|
|
|
"files_per_dir" : 3 }) |
|
|
|
self.do_remove_files() |
|
|
|
self.ok("destroy -R /newton/prep") # destroy again |
|
|
|
|
|
|
|
def test_14b_remove_files_maxint(self): |
|
|
|
# Limit max_int_removals, to cover more functionality. |
|
|
|
server_stop() |
|
|
|
server_start(max_int_removals = 1, |
|
|
|
bulkdata_args = { "file_size" : 920, # 23 rows per file |
|
|
|
"files_per_dir" : 3 }) |
|
|
|
self.do_remove_files() |
|
|
|
|
|
|
|
def do_remove_files(self): |
|
|
|
# Test BulkData's ability to remove when data is split into |
|
|
|
# multiple files. Should be a fairly comprehensive test of |
|
|
|
# remove functionality. |
|
|
|
|
|
|
|
# Insert data. Just for fun, insert out of order |
|
|
|
self.ok("create /newton/prep float32_8") |
|
|
|