From c316e37efefc18fca42c348d30412eefd99d68b0 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Sun, 21 Apr 2024 21:07:20 +0100 Subject: [PATCH] fix --- .../clickhouse/test/__snapshots__/test_schema.ambr | 2 +- posthog/clickhouse/test/test_schema.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/posthog/clickhouse/test/__snapshots__/test_schema.ambr b/posthog/clickhouse/test/__snapshots__/test_schema.ambr index ca16a0e24c53e..32977929a5942 100644 --- a/posthog/clickhouse/test/__snapshots__/test_schema.ambr +++ b/posthog/clickhouse/test/__snapshots__/test_schema.ambr @@ -2711,7 +2711,7 @@ , _offset UInt64 , _partition UInt64 - ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/CHM0060_20240421195443_{shard}/posthog.performance_events', '{replica}') + ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/CHM0060_fixed_for_snapshot_{shard}/posthog.performance_events', '{replica}') PARTITION BY toYYYYMM(timestamp) ORDER BY (team_id, toDate(timestamp), session_id, timestamp) diff --git a/posthog/clickhouse/test/test_schema.py b/posthog/clickhouse/test/test_schema.py index 10ce978c0b6c6..c826086293e8d 100644 --- a/posthog/clickhouse/test/test_schema.py +++ b/posthog/clickhouse/test/test_schema.py @@ -13,23 +13,24 @@ ) -@pytest.mark.parametrize("query", CREATE_TABLE_QUERIES, ids=get_table_name) -def test_create_table_query(query, snapshot): - built_query = build_query(query) +def normalize_snapshots(built_query): # some zookeeper paths change on each run of a migration # can look for /clickhouse/tables/M0060_date_ built_query = re.sub( r"/clickhouse/tables/(CHM0060_\d+_)", "/clickhouse/tables/CHM0060_fixed_for_snapshot_", built_query ) + return built_query - assert built_query == snapshot + +@pytest.mark.parametrize("query", CREATE_TABLE_QUERIES, ids=get_table_name) +def test_create_table_query(query, snapshot): + assert normalize_snapshots(build_query(query)) == snapshot @pytest.mark.parametrize("query", CREATE_MERGETREE_TABLE_QUERIES, ids=get_table_name) def test_create_table_query_replicated_and_storage(query, snapshot, settings): settings.CLICKHOUSE_ENABLE_STORAGE_POLICY = True - - assert build_query(query) == snapshot + assert normalize_snapshots(build_query(query)) == snapshot @pytest.mark.parametrize("query", CREATE_KAFKA_TABLE_QUERIES, ids=get_table_name)