Preserve connector source runtime evidence
This commit is contained in:
@@ -22,6 +22,11 @@ from govoplan_core.core.datasources import (
|
||||
DatasourceUnavailableError,
|
||||
DatasourceValidationError,
|
||||
)
|
||||
from govoplan_core.core.tabular_sources import (
|
||||
TabularPreviewDiagnostic,
|
||||
TabularPushdown,
|
||||
TabularSourceHealth,
|
||||
)
|
||||
from govoplan_core.db.base import Base, utcnow
|
||||
from govoplan_datasources.backend.db.models import (
|
||||
DatasourceGovernanceReferenceRecord,
|
||||
@@ -88,6 +93,13 @@ class FakeOriginProvider:
|
||||
fingerprint=f"version-{len(self.rows)}-{self.rows[-1]['name']}",
|
||||
row_count=len(self.rows),
|
||||
updated_at=utcnow(),
|
||||
source_mode="cached",
|
||||
pushdown=TabularPushdown(projections=True, pagination=True),
|
||||
health=TabularSourceHealth(
|
||||
status="healthy",
|
||||
code="snapshot.ready",
|
||||
summary="The immutable snapshot is ready.",
|
||||
),
|
||||
)
|
||||
|
||||
def list_origins(
|
||||
@@ -126,6 +138,18 @@ class FakeOriginProvider:
|
||||
rows=tuple(dict(row) for row in rows),
|
||||
total_rows=len(self.rows),
|
||||
truncated=request.offset + len(rows) < len(self.rows),
|
||||
returned_bytes=64,
|
||||
elapsed_ms=4,
|
||||
effective_row_limit=request.limit,
|
||||
effective_byte_limit=request.max_bytes,
|
||||
effective_timeout_ms=request.timeout_ms,
|
||||
diagnostics=(
|
||||
TabularPreviewDiagnostic(
|
||||
severity="info",
|
||||
code="preview.complete",
|
||||
message="The bounded preview completed.",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -513,10 +537,25 @@ class DatasourceLifecycleTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(2, live_read.total_rows)
|
||||
self.assertEqual(64, live_read.returned_bytes)
|
||||
self.assertEqual("preview.complete", live_read.diagnostics[0].code)
|
||||
self.assertEqual(
|
||||
"cached",
|
||||
live_read.datasource.metadata["source_contract"]["source_mode"],
|
||||
)
|
||||
self.assertTrue(
|
||||
live_read.datasource.metadata["source_contract"]["pushdown"][
|
||||
"projections"
|
||||
]
|
||||
)
|
||||
self.assertEqual(1, cached_before.total_rows)
|
||||
self.assertEqual(2, cached_live.total_rows)
|
||||
self.assertEqual(2, cached_after.total_rows)
|
||||
self.assertEqual(materialization.ref, refreshed.current_materialization_ref)
|
||||
self.assertEqual(
|
||||
"healthy",
|
||||
refreshed.metadata["source_contract"]["health"]["status"],
|
||||
)
|
||||
|
||||
def test_tenant_and_scope_isolation(self) -> None:
|
||||
stage = self.provider.create_stage(
|
||||
|
||||
Reference in New Issue
Block a user