Makes the blog-generated product run on the digital-core domain built from
semprini-data-domain, with the same changes the canonical template received:
- flink/job.sql connects to ods:5432/ods as postgres with ${ODS_PASSWORD},
substituted by data-domain at submission, instead of the blog's credentials
- lakehouse/010_replication.sql uses the platform's `ods` sync group and grants
the lake tables to ducklake_reader and ducklake_writer
- product.yaml sync group, odps.yaml access URLs (domain ports 20000-20003,
management zone Apicurio on 8081), CLI names in comments
Adds tests/: the canonical template's generic unit tests and this product's
expectations.yaml (seed rows, 24 constraint rejections, 5 relationship
traversals, one inbound-to-tombstone round trip).
Verified on digital-core on 2026-09-18: 65 of 65 smoke checks, 100 unit tests
passing, and registered in OpenMetadata under the digital-core domain.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
"""Seed data: every ODS table holds the rows ods/040_seed.sql inserts, with the values it inserts.
|
|
|
|
Generic canonical-product test, copied unchanged into every product. What to expect comes
|
|
from expectations.yaml beside it. Run from the domain repository: data-domain unit <product>.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from semprini_data_domain.testing import expectations_for, same_value
|
|
|
|
TABLES = list(expectations_for(__file__)["tables"].items())
|
|
SAMPLES = [(table, sample) for table, spec in TABLES for sample in spec.get("samples", [])]
|
|
|
|
|
|
def key_of(dp, table):
|
|
return next(t.key for t in dp.product.tables if t.name == table)
|
|
|
|
|
|
@pytest.mark.parametrize("table,spec", TABLES, ids=[t for t, _ in TABLES])
|
|
def test_seed_row_count(dp, table, spec):
|
|
rows = dp.sql(f"SELECT count(*) AS n FROM {dp.product.schema}.{table}")
|
|
assert rows[0]["n"] == spec["rows"]
|
|
|
|
|
|
@pytest.mark.parametrize("table,sample", SAMPLES, ids=[t for t, _ in SAMPLES])
|
|
def test_seed_row_values(dp, table, sample):
|
|
key = key_of(dp, table)
|
|
rows = dp.sql(f"SELECT * FROM {dp.product.schema}.{table} WHERE {key} = '{sample[key]}'")
|
|
assert len(rows) == 1, f"seed row {sample[key]} not in {table}"
|
|
for column, expected in sample.items():
|
|
assert same_value(expected, rows[0][column]), f"{table}.{column}: {rows[0][column]!r} != {expected!r}"
|