-
Notifications
You must be signed in to change notification settings - Fork 77
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
Ciac 11100 playbook run in build #4658
base: master
Are you sure you want to change the base?
Conversation
… of github.com:demisto/demisto-sdk into CIAC-11868-adding-fixtures-and-abilities-to-flow-tests
… of github.com:demisto/demisto-sdk into CIAC-11100-playbook-run-in-build
…00-playbook-run-in-build
…00-playbook-run-in-build
…00-playbook-run-in-build
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.
some minor comments but looks very good!
@@ -0,0 +1,4 @@ | |||
changes: | |||
- description: Adding new command **test-use-case** to test use case flows on cloud machines. |
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.
- description: Adding new command **test-use-case** to test use case flows on cloud machines. | |
- description: Added the **test-use-case** command to test use-case flows on cloud machines. |
@@ -132,6 +133,7 @@ def get_client_from_server_type( | |||
auth_id: Optional[str] = None, | |||
username: Optional[str] = None, | |||
password: Optional[str] = None, | |||
lcas_id: Optional[str] = None, |
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.
lcas_id: Optional[str] = None, | |
lcaas_id: Optional[str] = None, |
I'd go with "project_id", quicker to understand than the ugly devops term "lcaas", but not super critical
# Manually parse command-line argument | ||
for arg in request.config.invocation_params.args: | ||
if isinstance(arg, str) and arg.startswith("--client_conf="): | ||
logger.info("there is --client_conf recognized") |
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.
logger.info("there is --client_conf recognized") | |
logger.debug("Parsing --client_conf argument") |
""" | ||
|
||
def _process_response(self, response, status_code, expected_status=200): | ||
"""Process the HTTP response coming from the XSOAR client.""" |
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.
"""Process the HTTP response coming from the XSOAR client.""" | |
"""Process the HTTP response coming from the XSIAM client.""" |
@@ -2218,3 +2219,4 @@ class PlaybookTaskType(StrEnum): | |||
# Test types: | |||
TEST_PLAYBOOKS = "TestPlaybooks" | |||
TEST_MODELING_RULES = "TestModelingRules" | |||
Test_Use_Cases = "TestUseCases" |
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.
Test_Use_Cases = "TestUseCases" | |
TEST_USE_CASES = "TestUseCases" |
pyproject.toml
Outdated
@@ -126,6 +126,7 @@ pytest-github-actions-annotate-failures = "^0.2.0" | |||
pytest-sugar = "^1.0.0" | |||
pytest-loguru = "^0.4.0" | |||
|
|||
|
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.
if there's no change then we can revert the changes in both poetry files
logging_module.info("Start uploading test use case results file to bucket") | ||
|
||
storage_client = storage.Client.from_service_account_json(self.service_account) | ||
storage_bucket = storage_client.bucket(self.artifacts_bucket) | ||
|
||
blob = storage_bucket.blob( | ||
f"content-test-use-case/{repository_name}/{file_name}" | ||
) | ||
blob.upload_from_filename( | ||
original_file_path.as_posix(), | ||
content_type="application/xml", | ||
) | ||
|
||
logging_module.info("Finished uploading test use case results file to bucket") |
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.
logging_module.info("Start uploading test use case results file to bucket") | |
storage_client = storage.Client.from_service_account_json(self.service_account) | |
storage_bucket = storage_client.bucket(self.artifacts_bucket) | |
blob = storage_bucket.blob( | |
f"content-test-use-case/{repository_name}/{file_name}" | |
) | |
blob.upload_from_filename( | |
original_file_path.as_posix(), | |
content_type="application/xml", | |
) | |
logging_module.info("Finished uploading test use case results file to bucket") | |
logging_module.debug("Start uploading test use case results file to bucket") | |
storage_client = storage.Client.from_service_account_json(self.service_account) | |
storage_bucket = storage_client.bucket(self.artifacts_bucket) | |
blob = storage_bucket.blob( | |
f"content-test-use-case/{repository_name}/{file_name}" | |
) | |
blob.upload_from_filename( | |
original_file_path.as_posix(), | |
content_type="application/xml", | |
) | |
logging_module.debug("Finished uploading test use case results file to bucket") |
|
||
# --------------------------- Env Setup ------------------------------- | ||
|
||
logger.info("installing pyxdr...") |
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.
logger.info("installing pyxdr...") | |
logger.debug("installing pyxdr...") |
generally go over everything and ensure logs are info only for "user messages" and not for "developer messages"
I recommend reading the job logs in the gitlab UI to easily understand which info logs we actually want to be debug
except Exception: | ||
self.build_context.logging_module.exception("~~ Thread failed ~~") | ||
self.build_context.tests_data_keeper.errors = True |
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.
how does it behave in case of exception?
- will the rest of the threads continue?
- will we see the error message?
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, each thread should run its tests, the rest of the threads should keep running.
Also logs per thread are printed (with thread 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.
can we have one sanity E2E test (from the main command method)?
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.
Please update the file_name to end with _setup.py at the end.
Also, keep the logic of the command options here and then the call to the command itself.
The rest of the code - should be in a different file (the logic should be in a different file) - see examples in the other SDK commands (upload, download etc)
Added test-use-case command, to run use case flows on cloud machines.
Related Issues
fixes: https://jira-dc.paloaltonetworks.com/browse/CIAC-11867