|
10 | 10 | from infrahub.core.constants import DiffAction, InfrahubKind, SchemaPathType |
11 | 11 | from infrahub.core.diff.model.diff import DiffElementType |
12 | 12 | from infrahub.core.initialization import create_branch |
| 13 | +from infrahub.core.manager import NodeManager |
13 | 14 | from infrahub.core.node import Node |
14 | 15 | from infrahub.core.validators.enum import ConstraintIdentifier |
15 | 16 | from infrahub.database import InfrahubDatabase |
@@ -282,6 +283,7 @@ async def test_schema_integrity( |
282 | 283 | person = await Node.init(db=db, schema="TestPerson", branch=branch2) |
283 | 284 | await person.new(db=db, name="ALFRED", height=160, cars=[car_accord_main.id]) |
284 | 285 | await person.save(db=db) |
| 286 | + person_john = await NodeManager.get_one(db=db, branch=branch2, id=person_john_main.id) |
285 | 287 |
|
286 | 288 | branch2_schema = registry.schema.get_schema_branch(name=branch2.name) |
287 | 289 | person_schema = branch2_schema.get(name="TestPerson") |
@@ -329,3 +331,14 @@ async def test_schema_integrity( |
329 | 331 | ), |
330 | 332 | } |
331 | 333 | ] in all_conflicts |
| 334 | + |
| 335 | + # verify integrity checks are removed after being fixed |
| 336 | + person_john.name.value = "JOHN" |
| 337 | + await person_john.save(db=db) |
| 338 | + |
| 339 | + await run_proposed_change_schema_integrity_check(model=schema_integrity_01) |
| 340 | + |
| 341 | + checks = await registry.manager.query(db=db, schema=InfrahubKind.SCHEMACHECK) |
| 342 | + assert len(checks) == 1 |
| 343 | + assert checks[0].conclusion.value.value == "success" |
| 344 | + assert checks[0].conflicts.value == [] |
0 commit comments