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
test(dp): Retain DB state in orc8r integration tests #12607
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the DCO check after the last commit. |
7346ea9
to
336de04
Compare
@@ -389,26 +420,31 @@ def send_request_to_backend( | |||
method: str, url_suffix: str, params: Optional[Dict[str, Any]] = None, | |||
json: Optional[Dict[str, Any]] = None, | |||
) -> requests.Response: | |||
return requests.request( |
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 need for this change (I guess it was just used for debugging)
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.
Reverted.
@@ -378,7 +409,7 @@ def wait_for_elastic_to_start() -> None: | |||
|
|||
def when_elastic_indexes_data(): | |||
# TODO use retrying instead | |||
sleep(5) | |||
sleep(15) |
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 is painful, can we create a ticket for using retries for elastic?
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.
@@ -19,6 +19,8 @@ | |||
from threading import Event, Thread | |||
from time import sleep | |||
from typing import Any, Dict, List, Optional | |||
from unittest import TestCase |
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.
looks unused
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.
@@ -245,6 +260,17 @@ def when_cbsds_are_fetched( | |||
self.assertEqual(len(cbsds), expected_cbsds_num) | |||
return cbsds | |||
|
|||
def when_cbsd_is_fetched(self, serial_number: str = None) -> Dict[str, Any]: | |||
params = {} | |||
params['serial_number'] = serial_number |
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.
why not just params = {'serial_number': serial_number}
?
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.
Redone as suggested.
def then_cbsd_is_deleted(self): | ||
r = send_request_to_backend('get', 'cbsds') | ||
def then_cbsd_is_deleted(self, serial_number: str): | ||
params = {} |
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 a lot of duplication between this method and when_cbsd_is_fetched
method, can common part be extracted?
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.
Added private check method.
336de04
to
6bd6f88
Compare
* Do not clear/initialize DB in orc8r integration tests setup/teardown * Clear/initialize DB in orc8r integration testcase classes * Use randmized CBSD serial numbers per orc8r integration test to meet unique constraint on that field in the (now retained between tests) DB Signed-off-by: Artur Dębski <artur.debski@freedomfi.com>
6bd6f88
to
84e98dc
Compare
* Do not clear/initialize DB in orc8r integration tests setup/teardown * Clear/initialize DB in orc8r integration testcase classes * Use randmized CBSD serial numbers per orc8r integration test to meet unique constraint on that field in the (now retained between tests) DB Signed-off-by: Artur Dębski <artur.debski@freedomfi.com> Co-authored-by: Artur Dębski <artur.debski@freedomfi.com>
Summary
Additional Information