@@ -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