-
Notifications
You must be signed in to change notification settings - Fork 98
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
Implement "short" report generation option #135
Comments
We use a predefined schema to select the most interesting fields for printing. User can enable it with -ls flag. Additionally * Requests are now timed out by 120 seconds * Impersonation is now disabled by default * Unwrapped several unnecessary lists in responses * Fixes extra null output in GCS scanning results Related to #135
* feat: Enable lightweight scanning option We use a predefined schema to select the most interesting fields for printing. User can enable it with -ls flag. Additionally * Requests are now timed out by 120 seconds * Impersonation is now disabled by default * Unwrapped several unnecessary lists in responses * Fixes extra null output in GCS scanning results * [tests] Relaxing and updating unit tests * [tests] Printing error file on failure ( Related to #135
Implemented. We need to add tests for this feature and think about how to filter with our schema non-standard outputs. |
Hi @mshudrak! Could you please mention some more details about what type of tests we need here? |
Hi @SaxenaAnushka102, basically I implemented a new option for GCP Scanner to produce short version of the scanner report. We need to implement acceptance test similar to what we have for the whole scanner here: https://github.com/google/gcp_scanner/blob/main/src/gcp_scanner/test_acceptance.py |
Hi @mshudrak , could you also mention the file we need to make these changes into?-->I know these sound naive but these do come from my lack of experience, my nearest clue is to implement these changes in scanner.py Also, @SaxenaAnushka102 , do let me know if you are working on something and if I could be of any help. |
@Bhardwaj-Himanshu we need new test similar to what we have in test_acceptance.py. Likely new test file needed. |
Like this gcp_scanner/src/gcp_scanner/test_acceptance.py Lines 108 to 114 in 47fbba4
a new file or a new addition to the same? def new_test_function():
os.mkdir("res")
testargs = ["some_more_repositories", "-o", "res"]
with unittest.mock.patch("sys.argv", testargs):
assert scanner.main() == 0
assert len(os.listdir("res/")) == RESULTS_JSON_COUNT
validate_result() Do correct me and help on hints, if I am wrong anywhere, all feedbacks are welcomed. |
Thanks for the details @mshudrak! I'm reading docs related to tests & will update when I'll come up with a solution. |
@Bhardwaj-Himanshu That's a nice idea, let's work on it! |
Sure thing, @SaxenaAnushka102! |
@Bhardwaj-Himanshu I'm referring to the GCP Scanner's Wiki page and this Python documentation |
@Bhardwaj-Himanshu yes, that's the right approach. Whether you choose to expand test_acceptance or create an independent test is up to you. I'd probably just expand test_acceptance with another function. |
Thanks @SaxenaAnushka102 ;) |
Gotcha @mshudrak, now could help me defining what are the values which are required in the output and once which need to be omitted. But before that , I need to look into what a normal out report looks like in gcp_scanner_test_acceptance.py! |
You can take a look at Github Actions, there are full logs response there. As for actual output, one option is to prepare the test and print output. On the second iteration you can add that in the check file. |
Hi @mshudrak, first of all pardon me for a late response, got stuck under a very pleasant weather here(sarcasm, cause a storm came through chopping down all the electric lines for 5 days). Anyways, coming to the code, as being unable to write the new_test.py files myself, if you could help me look at some resources/codebase internally from gcp_scanner or outside for a general overview of how to write the same and most probably going to attach the function inside the test_acceptance.py, rather than creating a new file and breaking the whole code base! Thanks |
You can use test_acceptance.py as an example and Github Actions to see produced logs. There is function that does it. You just need to provide extra argument and implemented expected output. Just take a look at code. |
The function in the gcp_scanner/src/gcp_scanner/test_acceptance.py Lines 108 to 115 in 2b1ac6b
Which I am thinking to add another function as def new_test_function():
os.mkdir("res")
testargs = ["some_more_repositories", "-o", "res"] #but which repositories to target?
with unittest.mock.patch("sys.argv", testargs): #and what arguments to run?
assert scanner.main() == 0
assert len(os.listdir("res/")) == RESULTS_JSON_COUNT
validate_result() Also, if you could tell me a way to contact you other than github, weather email or any social media handle. I had a few things/ideas to discuss, not regarding this pull request, but in regards to documentation and forming a community for the repository!!--> I am totally fine with discussing here too, let me know! |
Is your feature request related to a problem? Please describe.
Right now, our scan result contains mostly all the data returned by GCP. It is hard to navigate and requires greping data.
Describe the solution you'd like
We can implement a flag that would tell the scanner to return only the most important data from GCP.
We need to define what would be the most important fields to return. We also need to think about a flexible approach on defining what to omit/return from the report.
The text was updated successfully, but these errors were encountered: