Show More
@@ -1271,17 +1271,17 class Hub(SessionFactory): | |||||
1271 | buffer_lens = [] if 'buffers' in keys else None |
|
1271 | buffer_lens = [] if 'buffers' in keys else None | |
1272 | result_buffer_lens = [] if 'result_buffers' in keys else None |
|
1272 | result_buffer_lens = [] if 'result_buffers' in keys else None | |
1273 | else: |
|
1273 | else: | |
1274 |
buffer_lens = |
|
1274 | buffer_lens = None | |
1275 |
result_buffer_lens = |
|
1275 | result_buffer_lens = None | |
1276 |
|
1276 | |||
1277 | for rec in records: |
|
1277 | for rec in records: | |
1278 | # buffers may be None, so double check |
|
1278 | # buffers may be None, so double check | |
|
1279 | b = rec.pop('buffers', empty) or empty | |||
1279 | if buffer_lens is not None: |
|
1280 | if buffer_lens is not None: | |
1280 | b = rec.pop('buffers', empty) or empty |
|
|||
1281 | buffer_lens.append(len(b)) |
|
1281 | buffer_lens.append(len(b)) | |
1282 | buffers.extend(b) |
|
1282 | buffers.extend(b) | |
|
1283 | rb = rec.pop('result_buffers', empty) or empty | |||
1283 | if result_buffer_lens is not None: |
|
1284 | if result_buffer_lens is not None: | |
1284 | rb = rec.pop('result_buffers', empty) or empty |
|
|||
1285 | result_buffer_lens.append(len(rb)) |
|
1285 | result_buffer_lens.append(len(rb)) | |
1286 | buffers.extend(rb) |
|
1286 | buffers.extend(rb) | |
1287 | content = dict(status='ok', records=records, buffer_lens=buffer_lens, |
|
1287 | content = dict(status='ok', records=records, buffer_lens=buffer_lens, |
@@ -223,6 +223,14 class TestClient(ClusterTestCase): | |||||
223 | for rec in found: |
|
223 | for rec in found: | |
224 | self.assertEquals(set(rec.keys()), set(['msg_id', 'submitted', 'completed'])) |
|
224 | self.assertEquals(set(rec.keys()), set(['msg_id', 'submitted', 'completed'])) | |
225 |
|
225 | |||
|
226 | def test_db_query_default_keys(self): | |||
|
227 | """default db_query excludes buffers""" | |||
|
228 | found = self.client.db_query({'msg_id': {'$ne' : ''}}) | |||
|
229 | for rec in found: | |||
|
230 | keys = set(rec.keys()) | |||
|
231 | self.assertFalse('buffers' in keys, "'buffers' should not be in: %s" % keys) | |||
|
232 | self.assertFalse('result_buffers' in keys, "'result_buffers' should not be in: %s" % keys) | |||
|
233 | ||||
226 | def test_db_query_msg_id(self): |
|
234 | def test_db_query_msg_id(self): | |
227 | """ensure msg_id is always in db queries""" |
|
235 | """ensure msg_id is always in db queries""" | |
228 | found = self.client.db_query({'msg_id': {'$ne' : ''}},keys=['submitted', 'completed']) |
|
236 | found = self.client.db_query({'msg_id': {'$ne' : ''}},keys=['submitted', 'completed']) |
General Comments 0
You need to be logged in to leave comments.
Login now