diff --git a/monitoring/prober/infrastructure.py b/monitoring/prober/infrastructure.py index 348dd28670..95e3aac299 100644 --- a/monitoring/prober/infrastructure.py +++ b/monitoring/prober/infrastructure.py @@ -100,7 +100,7 @@ def wrapper_default_scope(*args, **kwargs): resource_type_code_descriptions: Dict[ResourceType, str] = {} -# Next code: 383 +# Next code: 381 def register_resource_type(code: int, description: str) -> ResourceType: """Register that the specified code refers to the described resource. diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/authentication_validation.py b/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/authentication_validation.py index e89ad557bd..776b33e0e6 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/authentication_validation.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/authentication_validation.py @@ -41,7 +41,7 @@ class AuthenticationValidation(TestScenario): """ SUB_TYPE = register_resource_type( - 382, "Subscription, Operational Entity Id, Constraint" + 380, "Subscription, Operational Entity Id, Constraint" ) # Reuse the same ID for every type of entity. @@ -213,7 +213,7 @@ def _ensure_test_entities_dont_exist(self): query = qe.queries[0] check.record_failed( summary=f"Could not query OIR {self._test_id}", - details=f"When attempting to query OIR {self._test_id} from the DSS, received {query.response.status_code}: {qe.msg}", + details=f"When attempting to query OIR {self._test_id} from the DSS, received {query.response.status_code}: {qe}", query_timestamps=[query.request.timestamp], ) @@ -231,7 +231,6 @@ def _ensure_test_entities_dont_exist(self): details=f"When attempting to remove op intent reference {self._test_id} from the DSS, received {query.status_code}: {qe.msg}", query_timestamps=[query.request.timestamp], ) - self._dss.delete_op_intent(oir.id, oir.ovn) test_step_fragments.cleanup_sub(self, self._dss, self._test_id) diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/oir_api_validator.py b/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/oir_api_validator.py index d60ca62972..cacd70731f 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/oir_api_validator.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/oir_api_validator.py @@ -136,7 +136,7 @@ def _verify_oir_creation(self): ) as check: if no_scope_q.status_code != 401: check.record_failed( - summary=f"Expected 403, got {no_scope_q.status_code}", + summary=f"Expected 401, got {no_scope_q.status_code}", query_timestamps=[no_scope_q.request.timestamp], ) self._sanity_check_oir_not_created(check, no_scope_q) @@ -171,9 +171,18 @@ def _verify_oir_creation(self): query_timestamps=[valid_q.request.timestamp], ) - oir_resp = ImplicitDict.parse( - valid_q.response.json, ChangeOperationalIntentReferenceResponse - ) + # TODO use fragment. + try: + oir_resp = ImplicitDict.parse( + valid_q.response.json, ChangeOperationalIntentReferenceResponse + ) + except ValueError as e: + check.record_failed( + summary="Could not parse the response body", + details=f"Failed to parse the response body as a ChangeOperationalIntentReferenceResponse: {e}", + query_timestamps=[valid_q.request.timestamp], + ) + return # Save the current OIR self._current_oir = oir_resp.operational_intent_reference @@ -220,7 +229,7 @@ def _verify_oir_get(self): ) as check: if query_missing_scope.status_code != 401: check.record_failed( - summary=f"Expected 403, got {query_missing_scope.status_code}", + summary=f"Expected 401, got {query_missing_scope.status_code}", query_timestamps=[query_missing_scope.request.timestamp], ) @@ -332,7 +341,7 @@ def _verify_oir_mutation(self): if valid_q.status_code != 200: check.record_failed( summary=f"Expected 200, got {valid_q.status_code}", - details=f"Mutation is expected to have succeeded, but got status {valid_q.status_code} with body {valid_q.response.json} instead", + details=f"Mutation is expected to have succeeded, but got status {valid_q.status_code} with error {valid_q.error_message} instead", query_timestamps=[valid_q.request.timestamp], ) @@ -455,7 +464,7 @@ def _verify_oir_search(self): ) as check: if no_scope_q.status_code != 401: check.record_failed( - summary=f"Expected 403, got {no_scope_q.status_code}", + summary=f"Expected 401, got {no_scope_q.status_code}", query_timestamps=[no_scope_q.request.timestamp], ) @@ -493,11 +502,8 @@ def _sanity_check_oir_not_created( _, sanity_check = self._dss.get_op_intent_reference(self._test_id) self._scenario.record_query(sanity_check) except QueryError as qe: - for q in qe.queries: - self._scenario.record_query(q) - if qe.queries[0].response.status_code == 404: - pass # All is good - else: + self._scenario.record_queries(qe.queries) + if qe.queries[0].response.status_code != 404: check.record_failed( summary="OIR was created by an unauthorized request.", details="The Operational Intent Reference should not have been created, as the creation attempt was not authenticated.", @@ -523,17 +529,17 @@ def _sanity_check_oir_not_updated( ): check.record_failed( summary="OIR was updated by an unauthorized request.", - details="The Operational Intent Reference should not have been updated, as the update attempt was not authenticated.", + details=f"The Operational Intent Reference with id {self._test_id} should not have been updated, as the update attempt was not authenticated.", query_timestamps=[ creation_q.request.timestamp, sanity_check.request.timestamp, ], ) except QueryError as qe: - for q in qe.queries: - self._scenario.record_query(q) + self._scenario.record_queries(qe.queries) check.record_failed( summary="Could not fetch OIR to confirm it has not been mutated", + details=f"The Operational Intent Reference with id {self._test_id} could not be fetched to confirm it has not been mutated: {qe}", query_timestamps=[ creation_q.request.timestamp, qe.queries[0].request.timestamp, diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/test_step_fragments.py b/monitoring/uss_qualifier/scenarios/astm/utm/dss/test_step_fragments.py index c471774ba2..70b6d6ef19 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/test_step_fragments.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/test_step_fragments.py @@ -51,7 +51,7 @@ def cleanup_sub( if existing_sub.status_code not in [200, 404]: check.record_failed( summary=f"Could not query subscription {sub_id}", - details=f"When attempting to query subscription {sub_id} from the DSS, received {existing_sub.status_code} with body {existing_sub.response.json}", + details=f"When attempting to query subscription {sub_id} from the DSS, received {existing_sub.status_code} with body {existing_sub.error_message}", query_timestamps=[existing_sub.request.timestamp], ) @@ -64,7 +64,7 @@ def cleanup_sub( if deleted_sub.status_code != 200: check.record_failed( summary=f"Could not delete subscription {sub_id}", - details=f"When attempting to delete subscription {sub_id} from the DSS, received {deleted_sub.status_code} with body {deleted_sub.response.json}", + details=f"When attempting to delete subscription {sub_id} from the DSS, received {deleted_sub.status_code} with body {deleted_sub.error_message}", query_timestamps=[deleted_sub.request.timestamp], )