Skip to content

Commit

Permalink
[uss_qualifier] constraint reference sync: cover deletion 5/5 (#708)
Browse files Browse the repository at this point in the history
[uss_qualifier] Constraint reference synchronization scenario
  • Loading branch information
Shastick authored Aug 2, 2024
1 parent 79294c7 commit 6a823a2
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Delete constraint reference test step fragment

This test step fragment validates that constraint references can be deleted

## 🛑 Delete constraint reference query succeeds check

A query to delete a constraint reference, by its owner and when the correct OVN is provided, should succeed, otherwise the DSS is in violation of **[astm.f3548.v21.DSS0005,3](../../../../../../../requirements/astm/f3548/v21.md)**.

## 🛑 Delete constraint reference response format conforms to spec check

The response to a successful constraint reference deletion query is expected to conform to the format defined by the OpenAPI specification under the `A3.1` Annex of ASTM F3548−21.

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

## 🛑 Delete constraint reference response content is correct check

A successful constraint reference deletion query is expected to return a body, the content of which reflects the constraint reference at the moment of deletion.
If the content of the response does not correspond to what was requested, the DSS is failing to implement **[astm.f3548.v21.DSS0005,3](../../../../../../../requirements/astm/f3548/v21.md)**.

This check will usually be performing a series of sub-checks from the [validate](../validate) fragments.
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,46 @@ Confirm that the constraint reference that was just updated is properly synchron

#### [CR version is correct](../fragments/cr/validate/non_mutated.md)

### Delete CR test step

Attempt to delete the constraint reference in various ways and ensure that the DSS reacts properly.

This also checks that the constraint reference data returned by a successful deletion is correct.

#### [Delete CR](../fragments/cr/crud/delete.md)

Confirm that an constraint reference can be deleted.

#### [Validate CR](../fragments/cr/validate/correctness.md)

Verify that the constraint reference returned by the DSS via the deletion is properly formatted and contains the correct content.

#### [CR Versions are correct](../fragments/cr/validate/non_mutated.md)

Verify that the constraint reference's version fields are as expected.

### Query deleted CR test step

Attempt to query and search for the deleted constraint reference in various ways

#### [Get CR query](../fragments/cr/crud/read_correct.md)

Check that read query succeeds.

#### 🛑 Deleted CR cannot be retrieved from all DSS instances check

If a DSS returns an constraint reference that was previously successfully deleted from the primary DSS,
either one of the primary DSS or the DSS that returned the constraint reference is in violation of **[astm.f3548.v21.DSS0210,2a](../../../../../requirements/astm/f3548/v21.md)**, **[astm.f3548.v21.DSS0210,A2-7-2,3b](../../../../../requirements/astm/f3548/v21.md)**,
**[astm.f3548.v21.DSS0215](../../../../../requirements/astm/f3548/v21.md)** and **[astm.f3548.v21.DSS0020](../../../../../requirements/astm/f3548/v21.md)**.

#### [Search CR](../fragments/cr/crud/search_query.md)

Check that search query succeeds.

#### 🛑 Deleted CR cannot be searched for from all DSS instances check

If a DSS returns an constraint reference that was previously successfully deleted from the primary DSS,
either one of the primary DSS or the DSS that returned the constraint reference is in violation of **[astm.f3548.v21.DSS0210,2a](../../../../../requirements/astm/f3548/v21.md)**, **[astm.f3548.v21.DSS0210,A2-7-2,3a](../../../../../requirements/astm/f3548/v21.md)**,
**[astm.f3548.v21.DSS0215](../../../../../requirements/astm/f3548/v21.md)** and **[astm.f3548.v21.DSS0020](../../../../../requirements/astm/f3548/v21.md)**.

## [Cleanup](../clean_workspace.md)
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,13 @@ def run(self, context: ExecutionContext):
)
self.end_test_step()

# Other steps to follow in subsequent PRs
self.begin_test_step("Delete CR")
self._test_delete_sub()
self.end_test_step()

self.begin_test_step("Query deleted CR")
self._test_get_deleted_cr()
self.end_test_step()

self.end_test_case()
self.end_test_scenario()
Expand Down Expand Up @@ -488,6 +494,103 @@ def _test_mutate_oir_shift_time(self):

self._current_cr = cr

def _test_delete_sub(self):
with self.check(
"Delete constraint reference query succeeds", [self._primary_pid]
) as check:
try:
oir, subs, q = self._dss.delete_constraint_ref(
self._cr_id, self._current_cr.ovn
)
self.record_query(q)
except QueryError as qe:
self.record_queries(qe.queries)
check.record_failed(
summary="Constraint reference deletion on primary DSS failed",
details=qe.msg,
query_timestamps=qe.query_timestamps,
)

with self.check(
"Delete constraint reference response content is correct",
[self._primary_pid],
) as check:
ConstraintReferenceValidator(
main_check=check,
scenario=self,
expected_manager=self._expected_manager,
participant_id=[self._primary_pid],
cr_params=self._cr_params,
).validate_deleted_cr(
expected_cr_id=self._cr_id,
deleted_cr=q,
expected_ovn=self._current_cr.ovn,
expected_version=self._current_cr.version,
)

self._current_cr = None

def _test_get_deleted_cr(self):
for secondary_dss in self._secondary_dss_instances:
self._confirm_secondary_has_no_oir(secondary_dss)

def _confirm_secondary_has_no_oir(self, secondary_dss: DSSInstance):
with self.check(
"Get constraint reference by ID",
secondary_dss.participant_id,
) as check:
try:
oir, q = secondary_dss.get_constraint_ref(self._cr_id)
self.record_query(q)
except QueryError as qe:
q = qe.cause
self.record_query(q)
if q.status_code != 404:
check.record_failed(
summary="GET for constraint reference failed",
details=f"Query for constraint reference failed: {qe.msg}",
query_timestamps=qe.query_timestamps,
)

with self.check(
"Deleted CR cannot be retrieved from all DSS instances",
[self._primary_pid, secondary_dss.participant_id],
) as check:
if q.status_code != 404:
check.record_failed(
summary="Secondary DSS still has the deleted constraint reference",
details=f"Expected 404, received {q.status_code}",
query_timestamps=[q.request.timestamp],
)

with self.check(
"Successful constraint reference search query",
[secondary_dss.participant_id],
) as check:
try:
crs, q = secondary_dss.find_constraint_ref(self._planning_area_volume4d)
self.record_query(q)
except QueryError as qe:
self.record_queries(qe.queries)
check.record_failed(
summary="Failed to search for constraint references",
details=f"Failed to query constraint references: got response code {qe.cause_status_code}: {qe.msg}",
query_timestamps=qe.query_timestamps,
)

constraint_ref_ids = set([cr.id for cr in crs])
with self.check(
"Deleted CR cannot be searched for from all DSS instances",
[self._primary_pid, secondary_dss.participant_id],
) as check:
# TODO fix same bug in OIR sync scenario
if self._cr_id in constraint_ref_ids:
check.record_failed(
summary="Secondary DSS still has the deleted constraint reference",
details=f"CR {self._cr_id} was found in the secondary DSS when searched for its expected geo-temporal extent",
query_timestamps=[q.request.timestamp],
)

def cleanup(self):
self.begin_cleanup()
self._ensure_clean_workspace_step()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

class ConstraintReferenceValidator:
"""
Wraps the validation logic for an constraint reference that was returned by a DSS
Wraps the validation logic for a constraint reference that was returned by a DSS
It will compare the provided CR with the parameters specified at its creation.
"""
Expand Down Expand Up @@ -464,3 +464,39 @@ def validate_searched_cr_format(
)
if errors:
fail_with_schema_errors(check, errors, t_dss)

def validate_deleted_cr(
self,
expected_cr_id: EntityID,
deleted_cr: fetch.Query,
expected_ovn: str,
expected_version: int,
) -> None:

t_dss = deleted_cr.request.timestamp

# Validate the response schema
with self._scenario.check(
"Delete constraint reference response format conforms to spec",
self._pid,
) as check:
errors = schema_validation.validate(
F3548_21.OpenAPIPath,
F3548_21.ChangeConstraintReferenceResponse,
deleted_cr.response.json,
)
if errors:
fail_with_schema_errors(check, errors, t_dss)

cr_resp = deleted_cr.parse_json_result(ChangeConstraintReferenceResponse)

# Validate the CR itself
self._validate_cr(
expected_entity_id=expected_cr_id,
dss_cr=cr_resp.constraint_reference,
t_dss=t_dss,
previous_ovn=None,
expected_ovn=expected_ovn,
previous_version=None,
expected_version=expected_version,
)
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/suites/astm/utm/dss_probing.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3a</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3b</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,4a</a></td>
Expand Down
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/suites/astm/utm/f3548_21.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3a</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3b</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,4a</a></td>
Expand Down
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/suites/faa/uft/message_signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3a</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3b</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,4a</a></td>
Expand Down
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/suites/interuss/dss/all_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,12 @@
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3a</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3b</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,4a</a></td>
Expand Down
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/suites/uspace/flight_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@
<tr>
<td><a href="../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3a</a></td>
<td>Implemented</td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3b</a></td>
<td>Implemented</td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,4a</a></td>
Expand Down
4 changes: 2 additions & 2 deletions monitoring/uss_qualifier/suites/uspace/required_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,12 @@
<tr>
<td><a href="../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3a</a></td>
<td>Implemented</td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,3b</a></td>
<td>Implemented</td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
<td><a href="../../scenarios/astm/utm/dss/synchronization/constraint_ref_synchronization.md">ASTM SCD DSS: Constraint Reference Synchronization</a><br><a href="../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a></td>
</tr>
<tr>
<td><a href="../../requirements/astm/f3548/v21.md">DSS0210,A2-7-2,4a</a></td>
Expand Down

0 comments on commit 6a823a2

Please sign in to comment.