-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(backend): Make demo data gen fast in tests (#26287)
Co-authored-by: Georgiy Tarasov <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8cdc80a
commit d1f7db9
Showing
10 changed files
with
79 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
|
||
from posthog.test.base import run_clickhouse_statement_in_parallel | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def setup_kafka_tables(django_db_setup): | ||
from posthog.clickhouse.client import sync_execute | ||
from posthog.clickhouse.schema import ( | ||
CREATE_KAFKA_TABLE_QUERIES, | ||
build_query, | ||
) | ||
from posthog.settings import CLICKHOUSE_CLUSTER, CLICKHOUSE_DATABASE | ||
|
||
kafka_queries = list(map(build_query, CREATE_KAFKA_TABLE_QUERIES)) | ||
run_clickhouse_statement_in_parallel(kafka_queries) | ||
|
||
yield | ||
|
||
kafka_tables = sync_execute( | ||
f""" | ||
SELECT name | ||
FROM system.tables | ||
WHERE database = '{CLICKHOUSE_DATABASE}' AND name LIKE 'kafka_%' | ||
""", | ||
) | ||
kafka_truncate_queries = [f"DROP TABLE {table[0]} ON CLUSTER '{CLICKHOUSE_CLUSTER}'" for table in kafka_tables] | ||
run_clickhouse_statement_in_parallel(kafka_truncate_queries) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters