mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-25 10:33:47 +03:00
Added profiling test
This commit is contained in:
parent
29a251b892
commit
0ddc31bc46
|
@ -199,3 +199,33 @@ class KillTest(TransactionTestCase):
|
||||||
p_update.wait()
|
p_update.wait()
|
||||||
|
|
||||||
self._check_data()
|
self._check_data()
|
||||||
|
|
||||||
|
|
||||||
|
# Used to profile sync execution time. Disabled by default
|
||||||
|
@skip
|
||||||
|
class ProfileTest(TransactionTestCase):
|
||||||
|
BATCH_SIZE = 10000
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
ClickHouseTestModel.get_storage().flush()
|
||||||
|
connections['default'].drop_database()
|
||||||
|
connections['default'].create_database()
|
||||||
|
migrate_app('tests', 'default')
|
||||||
|
|
||||||
|
# Disable sync for not interesting models
|
||||||
|
ClickHouseMultiTestModel.sync_enabled = False
|
||||||
|
ClickHouseTestModel.sync_enabled = False
|
||||||
|
|
||||||
|
TestModel.objects.bulk_create([
|
||||||
|
TestModel(created=datetime.datetime.now(), created_date='2018-01-01', value=i)
|
||||||
|
for i in range(self.BATCH_SIZE)
|
||||||
|
])
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
# Disable sync for not interesting models
|
||||||
|
ClickHouseMultiTestModel.sync_enabled = True
|
||||||
|
ClickHouseTestModel.sync_enabled = True
|
||||||
|
|
||||||
|
def test_sync(self):
|
||||||
|
ClickHouseCollapseTestModel.sync_batch_size = self.BATCH_SIZE
|
||||||
|
ClickHouseCollapseTestModel.sync_batch_from_storage()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user