Skip to content

Commit

Permalink
first pass of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shastick committed Oct 16, 2024
1 parent 3a10cf3 commit 06f2e7c
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# OIR's subscription can be updated test step fragment

## [Update the OIR's subscription](./crud/update_query.md)

This step verifies that an OIR attached to an explicit subscription can be mutated in order to be attached
to another explicit subscription that properly covers the extent of the OIR.

## [Fetch the OIR](./crud/read_query.md)

To determine if the OIR is attached to the correct subscription, the OIR is directly fetched from the DSS.

## 🛑 OIR is attached to expected subscription check

If the OIR returned by the DSS under test is not attached to the expected subscription,
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../../../requirements/astm/f3548/v21.md)**
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ Ensures that the explicit subscription provided upon creation of an OIR is prope

This step verifies that an OIR cannot be created when an explicit subscription that does not cover the extent of the OIR is specified.

#### 🛑 Request to create OIR with incorrect subscription fails check
#### 🛑 Request to create OIR with too short subscription fails check

If the DSS under test allows the qualifier to create an OIR with an explicit subscription that does not cover the extent of the OIR,
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**

### [Create an operational intent reference test step](./fragments/oir/crud/create_query.md)
### [Create an OIR with correct explicit subscription test step](./fragments/oir/crud/create_query.md)

When the provided subscription covers the extent of the OIR, the OIR can be created.

### [OIR is attached to expected subscription test step](./fragments/oir/oir_has_expected_subscription.md)
#### [OIR is attached to expected subscription](./fragments/oir/oir_has_expected_subscription.md)

This step verifies that the OIR is attached to the subscription provided upon creation.

Expand All @@ -66,24 +66,20 @@ Create an additional explicit subscription to be used in this test case.

This step verifies that an OIR's existing explicit subscription cannot be replaced with an explicit subscription that does not cover the extent of the OIR.

#### 🛑 Request to mutate OIR while providing an incorrect subscription fails check
#### 🛑 Request to mutate OIR while providing a too short subscription fails check

If the DSS under test allows the qualifier to replace an OIR's existing explicit subscription with an explicit subscription that does not cover the extent of the OIR,
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**

### [OIR is attached to expected subscription test step](./fragments/oir/oir_has_expected_subscription.md)
#### [OIR is attached to expected subscription](./fragments/oir/oir_has_expected_subscription.md)

This step verifies that the OIR is still attached to the previous, valid, subscription.
Verify that the OIR is still attached to the previous, valid, subscription.

### [Replace the OIR's explicit subscription test step](./fragments/oir/crud/update_query.md)
### [Replace the OIR's explicit subscription test step](./fragments/oir/oir_subscription_update.md)

This step verifies that an OIR attached to an explicit subscription can be mutated in order to be attached
to another explicit subscription that properly covers the extent of the OIR.

### [OIR is attached to expected subscription test step](./fragments/oir/oir_has_expected_subscription.md)

This step verifies that the OIR is attached to the subscription provided upon mutation.

## Deletion requires correct OVN test case

Ensures that a DSS will only delete OIRs when the correct OVN is presented.
Expand All @@ -94,7 +90,7 @@ This step resets the workspace for the present and following test cases by ensur

### [Create an operational intent reference test step](./fragments/oir/crud/create_query.md)

Create an operational intent reference to be used in this and the following test cases.
Create the operational intent reference that will be used for the deletion attempts that happen in the subsequent steps.

### Attempt deletion with missing OVN test step

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,14 @@ def run(self, context: ExecutionContext):

self.begin_test_case("Validate explicit subscription on OIR creation")
self._step_create_oir_insufficient_subscription()
self._step_create_oir(
oir_params=self._planning_area.get_new_operational_intent_ref_params(
key=[],
state=OperationalIntentState.Accepted,
uss_base_url=self._planning_area.get_base_url(),
time_start=datetime.now() - timedelta(seconds=10),
time_end=self._sub_params.end_time, # OIR ends at the same time as subscription
subscription_id=self._sub_id,
),
)
self._step_oir_has_correct_subscription(expected_sub_id=self._sub_id)
self._step_create_oir_sufficient_subscription()
self.end_test_case()

self.begin_test_case(
"Validate explicit subscription upon subscription replacement"
)
self._step_update_oir_with_insufficient_explicit_sub()
self._step_oir_has_correct_subscription(expected_sub_id=self._sub_id)
self._step_update_oir_with_sufficient_explicit_sub()
self._step_oir_has_correct_subscription(expected_sub_id=self._extra_sub_id)
self.end_test_case()

self.begin_test_case("Deletion requires correct OVN")
Expand Down Expand Up @@ -212,7 +200,7 @@ def _step_create_oir_insufficient_subscription(self):
)

with self.check(
"Request to create OIR with incorrect subscription fails", self._pid
"Request to create OIR with too short subscription fails", self._pid
) as check:
try:
_, _, q = self._dss.put_op_intent(
Expand Down Expand Up @@ -243,6 +231,42 @@ def _step_create_oir_insufficient_subscription(self):

self.end_test_step()

def _step_create_oir_sufficient_subscription(self):
oir_params = self._planning_area.get_new_operational_intent_ref_params(
key=[],
state=OperationalIntentState.Accepted,
uss_base_url=self._planning_area.get_base_url(),
time_start=datetime.now() - timedelta(seconds=10),
time_end=self._sub_params.end_time, # OIR ends at the same time as subscription
subscription_id=self._sub_id,
)

self.begin_test_step("Create an OIR with correct explicit subscription")
with self.check(
"Create operational intent reference query succeeds",
self._pid,
) as check:
try:
new_oir, subs, query = self._dss.put_op_intent(
extents=oir_params.extents,
key=oir_params.key,
state=oir_params.state,
base_url=oir_params.uss_base_url,
oi_id=self._oir_id,
subscription_id=oir_params.subscription_id,
)
self.record_query(query)
self._current_oir = new_oir
except QueryError as qe:
self.record_queries(qe.queries)
check.record_failed(
summary="Could not create operational intent reference",
details=f"Failed to create operational intent reference with error code {qe.cause_status_code}: {qe.msg}",
query_timestamps=qe.query_timestamps,
)
self._check_oir_has_correct_subscription(expected_sub_id=self._sub_id)
self.end_test_step()

def _step_update_oir_with_insufficient_explicit_sub(self):
# Create another subscription that is a few seconds short of covering the OIR:
oir_duration = (
Expand Down Expand Up @@ -273,7 +297,7 @@ def _step_update_oir_with_insufficient_explicit_sub(self):
"Attempt to replace OIR's existing explicit subscription with an insufficient one"
)
with self.check(
"Request to mutate OIR while providing an incorrect subscription fails",
"Request to mutate OIR while providing a too short subscription fails",
self._pid,
) as check:
try:
Expand Down Expand Up @@ -303,6 +327,7 @@ def _step_update_oir_with_insufficient_explicit_sub(self):
details=f"Was expecting an HTTP 400 response because of an insufficient subscription, but got {qe.cause_status_code} instead. {qe.msg}",
query_timestamps=qe.query_timestamps,
)
self._check_oir_has_correct_subscription(expected_sub_id=self._sub_id)
self.end_test_step()

def _step_update_oir_with_sufficient_explicit_sub(self):
Expand Down Expand Up @@ -338,10 +363,10 @@ def _step_update_oir_with_sufficient_explicit_sub(self):
details=f"Was expecting an HTTP 200 response for a mutation with valid parameters, but got {qe.cause_status_code} instead. {qe.msg}",
query_timestamps=qe.query_timestamps,
)
self._check_oir_has_correct_subscription(expected_sub_id=self._extra_sub_id)
self.end_test_step()

def _step_oir_has_correct_subscription(self, expected_sub_id: SubscriptionID):
self.begin_test_step("OIR is attached to expected subscription")
def _check_oir_has_correct_subscription(self, expected_sub_id: SubscriptionID):
with self.check("Get operational intent reference by ID", self._pid) as check:
try:
oir, q = self._dss.get_op_intent_reference(self._oir_id)
Expand All @@ -360,7 +385,6 @@ def _step_oir_has_correct_subscription(self, expected_sub_id: SubscriptionID):
summary="OIR is not attached to the correct subscription",
details=f"Expected OIR to be attached to subscription {expected_sub_id}, but it is attached to {oir.subscription_id}",
)
self.end_test_step()

def _step_attempt_delete_missing_ovn(self):

Expand Down

0 comments on commit 06f2e7c

Please sign in to comment.