mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 04:12:23 +01:00
92e8bbd283
* convert sessions table logic to TS * convert rest of sessions to TS * sessions table logic refactor, store date in the url * add back/forward buttons * load sessions based on the URL, not after mount --> avoids duplicate query if opening an url with a filter * prevent multiple queries * throw error if failed instead of returning an empty list * date from filters * rename offset to nextOffset * initial limit/offset block * indent sql * support limit + offset * load LIMIT+1 sessions in postgres, pop last and show load more sign. (was: show sign if exactly LIMIT fetched) * based offset is always 0 * default limit to 50 * events in clickhouse sessions * add elements to query results * add person properties to sessions query response * show seconds with two digits * fix pagination, timestamp calculation and ordering on pages 2 and beyond * mypy * fix test * add default time to fix test, fix some any(*) filter issues * remove reverse * WIP event list * Events progress * Finish off event listing, skip live actions for now * Fix mypy * Fix mypy again * Try fixing mypy * Fix assertnumqueries * Fix tests * Fix tests * fix test * Fix tests * Fix tests * Fix tests again Co-authored-by: Marius Andra <marius.andra@gmail.com> Co-authored-by: Eric <eeoneric@gmail.com>
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from django.test.runner import DiscoverRunner
|
|
from infi.clickhouse_orm import Database # type: ignore
|
|
|
|
from posthog.settings import (
|
|
CLICKHOUSE_DATABASE,
|
|
CLICKHOUSE_HTTP_URL,
|
|
CLICKHOUSE_PASSWORD,
|
|
CLICKHOUSE_USERNAME,
|
|
CLICKHOUSE_VERIFY,
|
|
)
|
|
|
|
|
|
class ClickhouseTestRunner(DiscoverRunner):
|
|
def get_database(self) -> Database:
|
|
return Database(
|
|
CLICKHOUSE_DATABASE,
|
|
db_url=CLICKHOUSE_HTTP_URL,
|
|
username=CLICKHOUSE_USERNAME,
|
|
password=CLICKHOUSE_PASSWORD,
|
|
verify_ssl_cert=CLICKHOUSE_VERIFY,
|
|
)
|
|
|
|
def setup_databases(self, **kwargs):
|
|
database = self.get_database()
|
|
try:
|
|
database.drop_database()
|
|
except:
|
|
pass
|
|
database.create_database()
|
|
database.migrate("ee.clickhouse.migrations")
|
|
return super().setup_databases(**kwargs)
|
|
|
|
def teardown_databases(self, old_config, **kwargs):
|
|
try:
|
|
self.get_database().drop_database()
|
|
except:
|
|
pass
|
|
super().teardown_databases(old_config, **kwargs)
|