-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[monitorlib] Retrieve interactions from mock uss #270
[monitorlib] Retrieve interactions from mock uss #270
Conversation
When submitting PRs in the future, please follow the general contributing procedure -- specifically, we'd like to have PRs as drafts until ready to review (meaning CI has passed, or the contributor cannot resolve the CI issue). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get_interactions method for the mock_uss client looks good. I think we need scenario documentation before we get to scenario implementation in test_steps.py though. I'm also not clear on why Interactions should be called out separately in FailedChecks given existing Query capture.
@@ -88,6 +90,9 @@ class TestStepReport(ImplicitDict): | |||
passed_checks: List[PassedCheck] | |||
"""The checks which successfully passed in this test step""" | |||
|
|||
interuss_interactions: Optional[List[Interaction]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no need to list the interactions here as the FailedCheck should refer to the Query uss_qualifier used to obtain the Interactions from mock_uss which contains the full Interaction information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few cases where the uss_qualifier query from mock_uss is not sufficient.
- We would not be able to tell if injection by SUT failed due a GET call to mock_uss that. gave invalid data, wrong authorization or, message signing validation, by looking at the query from qualifier only. For data validation tests we want to make sure that it was invalid data that SUT received.
- We would need to check interactions, to capture POST by SUT to mock_uss, and validate it.
Hence I think interactions should be provided in the test steps which have test cases depending on these interactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query I'm talking about is when uss_qualifier asks mock_uss for its interactions; the response body for that query is this. We should already be logging that query, and therefore logging the response body, and associating that query with any failed checks. Therefore, List[Interaction] is already in the report and including it in the failed check would be duplicative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's the one I am using to get the interaction logs from mock_uss and analyze them in uss_qualifier for the GET or POST that we are expecting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, you mean those queries are being recorded. I didn't see the query recorded. In fact I queried and used the response to filter out the required interactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uss_qualifier is responsible for reporting what it's doing. A test scenario implementation should record_query
whenever uss_qualifier interacts with an external system, and then it should usually reference that query in any checks whose failure was determined based on that query (though we're still working on doing this consistently). Query events have the world icon in sequence view (example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed interuss_interactions.
if mock_uss is not None: | ||
interactions = _get_interuss_interactions(scenario, mock_uss, st, test_step) | ||
logger.debug(f"Checking for Post to {posted_to_url}") | ||
with scenario.check("Expect Notification sent") as check: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no documentation supporting this check yet -- let's follow the test scenarios development guide and build from requirements -> implementation plan -> scenario documentation -> scenario implementation. This is already the implementation and it's hard to evaluate without knowing the context in which it will be used via the foundation of the earlier development steps.
As noted in the implementation plan, no plan is needed beforehand when the goal can be advanced with small PRs (this PR is small) that don't have unimplemented dependencies (this PR implicitly depends on scenario documentation that isn't written).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to provide a context for the changes that I have in this PR. And, thought that these methods can provide the context. But, I do understand that they don't have the documentation with it. Do you want me to add the documentation in this PR? Or should I remove this file and add it to another PR with documentation? I can do it as you think will be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would almost always suggest erring on the side of small PRs with established context. I think the fact that both the API/endpoint for getting interactions and the mock_uss client already exist provide excellent context for get_interactions. The sequence of steps in the test scenarios development guide is designed to ensure sufficient context at each point -- I would suggest waiting to propose this file until the context for the test scenario implementation has been established by completing everything applicable on the requirements -> implementation plan -> scenario documentation -> scenario implementation chain prior to scenario implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I ll remove this file from the current PR, and add it in later PR.
I have changed this PR to draft. |
The pull request should be created as a draft and then marked as ready for review when the CI passes or there is a problem with the CI where reviewer help is needed. |
@BenjaminPelletier I have removed the test_steps.py file and the interuss_interactions from step report. Could you please check if PR looks good now. Thanks |
Sure -- you can also mark the PR as ready for review to trigger a next look from reviewers ("Ready for review" button near the bottom of this page). It looks like this branch needs to be sync'd with the main branch ("This branch is out-of-date with the base branch" near the bottom of this page). I recommend merging main into this branch (that's what I do) -- this preserves all of your edit history so that if the merge breaks something, you can always go back to the commit you know works. Rebasing is fine also, but that rewrites history and so therefore you can't necessarily go back to a known-working state. We always squash PRs when merging which means there's no need to try and maintain a clean edit history on a PR branch (the most common reason to rebase rather than merge) -- "messy" merge commits are totally fine. |
Ready for review. |
@@ -22,6 +22,8 @@ | |||
from monitoring.uss_qualifier.scenarios.definitions import TestScenarioTypeName | |||
from monitoring.uss_qualifier.suites.definitions import TestSuiteActionDeclaration | |||
|
|||
from monitoring.mock_uss.interaction_logging.interactions import Interaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import is no longer needed
* Recording interuss interactions from mock_uss * Fixed format * Fixing format * Removing import of non-exisitng module * Removing a file that should go in with scenario PR * Removing interaction recording in test steps as per PR review 5a685db
) * Make skipped actions first-class actions in report * Fix tested_requirements * Fix lingering issue from #270
…nteruss#278) * Make skipped actions first-class actions in report * Fix tested_requirements * Fix lingering issue from interuss#270 5807899
USSQualifier can request interuss interactions from mock_uss and add it test steps report.