Skip to content

Commit 0caf523

Browse files
committed
PR comments
1 parent 82bcdad commit 0caf523

File tree

3 files changed

+32
-34
lines changed

3 files changed

+32
-34
lines changed

monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/subscription_synchronization.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Verify that the version of the subscription returned by the DSS is as expected
156156

157157
Attempt to query and search for the deleted subscription in various ways
158158

159-
#### 🛑 Secondary DSS should not return the deleted subscription check
159+
#### 🛑 DSS should not return the deleted subscription check
160160

161161
If a DSS returns a subscription that was previously successfully deleted from the primary DSS,
162162
either one of the primary DSS or the DSS that returned the subscription is in violation of **[astm.f3548.v21.DSS0210,1a](../../../../../requirements/astm/f3548/v21.md)**.
@@ -177,15 +177,9 @@ Verify that the subscription returned by the DSS via the deletion is properly fo
177177

178178
Verify that the version of the subscription returned by the DSS is as expected
179179

180-
#### 🛑 Secondary DSS should not return the deleted subscription check
180+
#### 🛑 DSS should not return the deleted subscription check
181181

182182
If a DSS returns a subscription that was previously successfully deleted from the primary DSS,
183183
either one of the primary DSS or the DSS that returned the subscription is in violation of **[astm.f3548.v21.DSS0210,1a](../../../../../requirements/astm/f3548/v21.md)**.
184184

185-
#### 🛑 Primary DSS should not return the deleted subscription check
186-
187-
If the primary DSS returns a subscription that was previously successfully deleted from a secondary DSS,
188-
either one of the secondary or primary DSS is in violation of **[astm.f3548.v21.DSS0210,1a](../../../../../requirements/astm/f3548/v21.md)**.
189-
190-
191185
## [Cleanup](../clean_workspace.md)

monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/subscription_synchronization.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,6 @@ def _ensure_no_active_subs_exist(self):
220220
def _step_create_subscriptions(self):
221221
# Create the 'main' test subscription:
222222
main_sub = self._create_sub_with_params(self._sub_params)
223-
if main_sub is None:
224-
return
225223

226224
self._current_subscription = main_sub
227225

@@ -230,14 +228,12 @@ def _step_create_subscriptions(self):
230228
params = self._sub_params.copy()
231229
params.sub_id = sub_id
232230
extra_sub = self._create_sub_with_params(params)
233-
if extra_sub is None:
234-
return
235231
self._subs_for_deletion[sub_id] = extra_sub
236232
self._subs_for_deletion_params[sub_id] = params
237233

238234
def _create_sub_with_params(
239235
self, creation_params: SubscriptionParams
240-
) -> Optional[Subscription]:
236+
) -> Subscription:
241237

242238
# TODO migrate to the try/except pattern for queries
243239
newly_created = self._dss.upsert_subscription(
@@ -255,7 +251,6 @@ def _create_sub_with_params(
255251
details=f"Subscription creation failed with status code {newly_created.status_code}",
256252
query_timestamps=[newly_created.request.timestamp],
257253
)
258-
return None
259254

260255
with self.check(
261256
"Create subscription response is correct", [self._primary_pid]
@@ -556,7 +551,7 @@ def _compare_upsert_resp_with_params(
556551

557552
def _mutate_subscription_with_dss(
558553
self, dss_instance: DSSInstance, new_params: SubscriptionParams
559-
) -> bool:
554+
):
560555
"""
561556
Mutate the subscription on the given DSS instance using the given parameters.
562557
Also updates the internal state of the scenario to reflect the new subscription.
@@ -574,7 +569,6 @@ def _mutate_subscription_with_dss(
574569
details=f"Subscription mutation failed with status code {mutated_sub_response.status_code}",
575570
query_timestamps=[mutated_sub_response.request.timestamp],
576571
)
577-
return False
578572

579573
# Check that what we get back is valid and corresponds to what we want to create
580574
self._compare_upsert_resp_with_params(
@@ -584,7 +578,6 @@ def _mutate_subscription_with_dss(
584578
self._current_subscription = mutated_sub_response.subscription
585579
# Update the parameters we used for that subscription
586580
self._sub_params = new_params
587-
return True
588581

589582
def _step_mutate_subscriptions_broadcast_shift_time(self):
590583
"""Mutate the subscription on the primary DSS by adding 10 seconds to its start and end times"""
@@ -599,12 +592,10 @@ def _step_mutate_subscriptions_secondaries_shift_time(self):
599592

600593
for secondary_dss in self._dss_read_instances:
601594
# Mutate the subscription on the secondary DSS
602-
if not self._mutate_subscription_with_dss(
595+
self._mutate_subscription_with_dss(
603596
secondary_dss,
604597
shift_time_params(self._sub_params, timedelta(seconds=10)),
605-
):
606-
# If the mutation failed but the scenario has not terminated, we end this step here.
607-
return
598+
)
608599
# Check that the mutation was propagated to every DSS:
609600
self._query_secondaries_and_compare(self._sub_params)
610601

@@ -674,29 +665,42 @@ def _step_delete_subscriptions_on_secondaries(self):
674665
# If the deletion failed but the scenario has not terminated, we end this step here.
675666
return
676667
# Check that the primary knows about the deletion:
677-
self._confirm_dss_has_no_sub(self._dss, sub_id, is_primary=True)
668+
self._confirm_dss_has_no_sub(
669+
self._dss, sub_id, secondary_dss.participant_id
670+
)
678671
# Check that the deletion was propagated to every DSS:
679-
self._confirm_no_secondary_has_sub(sub_id)
672+
self._confirm_no_secondary_has_sub(sub_id, secondary_dss.participant_id)
680673

681674
def _step_get_deleted_sub(self):
682-
self._confirm_no_secondary_has_sub(self._sub_id)
675+
self._confirm_no_secondary_has_sub(self._sub_id, self._dss.participant_id)
683676

684-
def _confirm_no_secondary_has_sub(self, sub_id: str):
677+
def _confirm_no_secondary_has_sub(
678+
self, sub_id: str, deleted_on_participant_id: str
679+
):
680+
"""Confirm that no secondary DSS has the subscription.
681+
deleted_on_participant_id specifies the participant_id of the DSS where the subscription was deleted."""
685682
for secondary_dss in self._dss_read_instances:
686-
self._confirm_dss_has_no_sub(secondary_dss, sub_id, is_primary=False)
683+
self._confirm_dss_has_no_sub(
684+
secondary_dss, sub_id, deleted_on_participant_id
685+
)
687686

688687
def _confirm_dss_has_no_sub(
689-
self, dss_instance: DSSInstance, sub_id: str, is_primary: bool = False
688+
self,
689+
dss_instance: DSSInstance,
690+
sub_id: str,
691+
other_participant_id: Optional[str],
690692
):
691-
check_name = (
692-
"Primary DSS should not return the deleted subscription"
693-
if is_primary
694-
else "Secondary DSS should not return the deleted subscription"
693+
"""Confirm that a DSS has no subscription.
694+
other_participant_id may be specified if a failed check may be caused by it."""
695+
participants = (
696+
[dss_instance.participant_id, other_participant_id]
697+
if other_participant_id
698+
else None
695699
)
696700
fetched_sub = dss_instance.get_subscription(sub_id)
697701
with self.check(
698-
check_name,
699-
[dss_instance.participant_id],
702+
"DSS should not return the deleted subscription",
703+
participants,
700704
) as check:
701705
if fetched_sub.status_code != 404:
702706
check.record_failed(

monitoring/uss_qualifier/scenarios/astm/utm/dss/test_step_fragments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def cleanup_sub(
5151
if existing_sub.status_code not in [200, 404]:
5252
check.record_failed(
5353
summary=f"Could not query subscription {sub_id}",
54-
details=f"When attempting to query subscription {sub_id} from the DSS, received {existing_sub.status_code}: {existing_sub.json_result}",
54+
details=f"When attempting to query subscription {sub_id} from the DSS, received {existing_sub.status_code}: {existing_sub.error_message}",
5555
query_timestamps=[existing_sub.request.timestamp],
5656
)
5757

0 commit comments

Comments
 (0)