Skip to content

Commit 5127885

Browse files
fix(data-migration): FTRS-1623 Fix validation error test to use invalid_records metric
1 parent 7e8c2be commit 5127885

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/service_automation/tests/step_definitions/data_migration_steps/test_data_migration_address_steps.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,21 @@ def service_should_have_validation_error(error_code: str, migration_context: Dic
130130
"""Verify that a service migration resulted in a validation error with the specified code.
131131
132132
This checks that the service was not successfully migrated due to validation errors.
133-
The error should be captured in the migration context metrics.
133+
The error should be captured in the migration result metrics as an invalid record.
134134
"""
135-
metrics = migration_context.get("metrics", {})
135+
result = migration_context.get("result")
136+
assert result is not None, "Migration result not found in context"
136137

137-
# Service with validation errors should not be migrated
138-
assert metrics.get("errors", 0) > 0, (
139-
f"Expected service to have validation errors, but errors count is {metrics.get('errors', 0)}"
138+
metrics = result.metrics
139+
assert metrics is not None, "Metrics not found in migration result"
140+
141+
# Service with validation errors should be marked as invalid
142+
assert metrics.invalid_records > 0, (
143+
f"Expected service to be marked as invalid, but invalid_records count is {metrics.invalid_records}"
140144
)
141145

142-
# The service should be counted as transformed but not migrated
143-
assert metrics.get("migrated", 0) == 0, (
146+
# The service should not be migrated
147+
assert metrics.migrated_records == 0, (
144148
f"Expected service not to be migrated due to validation error '{error_code}', "
145-
f"but migrated count is {metrics.get('migrated', 0)}"
149+
f"but migrated_records count is {metrics.migrated_records}"
146150
)

0 commit comments

Comments
 (0)