Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ The response to a successful get subscription query is expected to conform to th

If it does not, the DSS is failing to implement **[astm.f3548.v21.DSS0005,5](../../../../../../../requirements/astm/f3548/v21.md)**.

## 🛑 Get subscription response content is correct check

A successful query for a subscription is expected to return a body, the content of which reflects the created subscription.
If the content of the response does not correspond to what was requested, the DSS is failing to implement **[astm.f3548.v21.DSS0005,5](../../../../../../../requirements/astm/f3548/v21.md)**.

This check will usually be performing a series of sub-checks from the [validate](../validate) fragments.

## [Validate subscription fields](../validate/correctness.md)

## [Validate version fields](../validate/non_mutated.md)
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ All subscriptions are left on the DSS when this step ends, as they are expected

Query the created subscription at every DSS provided in `dss_instances` to confirm that it is properly synchronized across all DSS instances,
and that it can be accessed directly by ID or searched for by area.

#### [Subscription is synchronized](../fragments/sub/sync.md)

#### [Get subscription](../fragments/sub/crud/read_correct.md)

#### [Search subscription](../fragments/sub/crud/search_correct.md)
#### [Search subscription](../fragments/sub/crud/search_query.md)

### Mutate subscription broadcast test step

Expand All @@ -98,7 +97,7 @@ Query the updated subscription at every DSS provided in `dss_instances` to confi

#### [Get subscription](../fragments/sub/crud/read_correct.md)

#### [Search subscription](../fragments/sub/crud/search_correct.md)
#### [Search subscription](../fragments/sub/crud/search_query.md)

### Mutate subscription on secondaries test step

Expand Down Expand Up @@ -131,7 +130,7 @@ Note that this step is repeated for every secondary DSS instance.

#### [Get subscription](../fragments/sub/crud/read_correct.md)

#### [Search subscription](../fragments/sub/crud/search_correct.md)
#### [Search subscription](../fragments/sub/crud/search_query.md)

### Create subscription with different credentials test step

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,26 @@ def _validate_get_sub_from_secondary(
):
"""Fetches the subscription from the secondary DSS and validates it."""
with self.check(
"Subscription can be found at every DSS",
involved_participants,
"Get Subscription by ID",
secondary_dss.participant_id,
) as check:
fetched_sub = secondary_dss.get_subscription(expected_sub_params.sub_id)
self.record_query(fetched_sub)
if fetched_sub.status_code != 200:
# At this point we just check that the request itself returned successfully.
if fetched_sub.error_message is not None:
check.record_failed(
"Get query for existing subscription failed",
details=f"Get query for a subscription expected to exist failed with status code {fetched_sub.status_code}",
details=f"Get query for a subscription expected to exist failed with status code {fetched_sub.status_code}, error: {fetched_sub.error_message}",
query_timestamps=[fetched_sub.request.timestamp],
)

with self.check(
"Subscription can be found at every DSS", involved_participants
) as check:
if fetched_sub.status_code != 200:
check.record_failed(
"Subscription was not found at every DSS",
details=f"Get query for a subscription expected to exist failed with status code {fetched_sub.status_code}.",
query_timestamps=[fetched_sub.request.timestamp],
)

Expand Down Expand Up @@ -512,6 +523,25 @@ def _validate_get_sub_from_secondary(
query_timestamps=[fetched_sub.request.timestamp],
)

with self.check(
"Get subscription response content is correct",
involved_participants,
) as check:
# The above checks validate synchronization requirements. The check below validates the correctness requirements
# (The logic is similar, but it covers different requirements in the standard).
SubscriptionValidator(
check,
self,
involved_participants,
expected_sub_params,
).validate_fetched_subscription(
expected_sub_id=expected_sub_params.sub_id,
fetched_sub=fetched_sub,
expected_version=self._current_subscription.version,
is_implicit=False,
validate_schema=False, # schema validated only for secondary DSS participant in check below
)

# Finally, validate the response schema
with self.check(
"Get subscription response format conforms to spec",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,23 +376,25 @@ def validate_fetched_subscription(
fetched_sub: FetchedSubscription,
expected_version: str,
is_implicit: bool,
validate_schema: bool = True,
) -> None:
"""Validate a subscription that was directly queried by its ID.
Callers must specify if this is an implicit subscription or not."""

(t_dss, sub) = (fetched_sub.request.timestamp, fetched_sub.subscription)

# Validate the response schema
with self._scenario.check(
"Get subscription response format conforms to spec", self._pid
) as check:
errors = schema_validation.validate(
F3548_21.OpenAPIPath,
F3548_21.GetSubscriptionResponse,
fetched_sub.response.json,
)
if errors:
fail_with_schema_errors(check, errors, t_dss)
if validate_schema:
with self._scenario.check(
"Get subscription response format conforms to spec", self._pid
) as check:
errors = schema_validation.validate(
F3548_21.OpenAPIPath,
F3548_21.GetSubscriptionResponse,
fetched_sub.response.json,
)
if errors:
fail_with_schema_errors(check, errors, t_dss)

# Validate the subscription itself
self._validate_sub(
Expand Down
Loading