Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Apr 21, 2024
1 parent 6109a2f commit c316e37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion posthog/clickhouse/test/__snapshots__/test_schema.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 7 additions & 6 deletions posthog/clickhouse/test/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c316e37

Please sign in to comment.