Publish curated ITWorx-ModelForge source from 990401737f96c8d46a9f7b0d84994516cadcb6a0
This commit is contained in:
1 parent
7082ab955a
commit
848f0d8f8a
434 files changed
+67298
-4315
No files matched your search
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import uuid
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
from sqlalchemy import create_engine
|
||||
@@ -579,3 +580,28 @@ def test_migration_events_are_append_only(session: Session) -> None:
|
||||
with pytest.raises(ValueError, match="append-only"):
|
||||
stored.reason = "rewritten"
|
||||
session.commit()
|
||||
|
||||
|
||||
def test_plan_index_respects_the_requested_result_limit(session: Session) -> None:
|
||||
service, first = planned_migration(session, target="m13-index-first")
|
||||
source = session.get(MigrationPlan, first.id)
|
||||
assert source is not None
|
||||
values = {column.key: getattr(source, column.key) for column in MigrationPlan.__table__.columns}
|
||||
values.update(
|
||||
id=uuid.uuid4(),
|
||||
target_shadow_target="m13-index-second",
|
||||
idempotency_key=f"m13-index-second-{uuid.uuid4()}",
|
||||
plan_fingerprint=digest("m13-index-second-plan"),
|
||||
created_at=source.created_at + timedelta(seconds=1),
|
||||
)
|
||||
second = MigrationPlan(**values)
|
||||
session.add(second)
|
||||
session.commit()
|
||||
|
||||
limited = service.plans(limit=1)
|
||||
complete = service.plans(limit=2)
|
||||
|
||||
assert len(limited) == 1
|
||||
assert limited[0].id == second.id
|
||||
assert len(complete) == 2
|
||||
assert {item.id for item in complete} == {first.id, second.id}
|
||||
Reference in new issue
Block a user