test: add comprehensive end-to-end mocked tests for all cloud scanners - #30
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a complete, end-to-end testing suite for SentinelRecon's cloud scanners (AWS, Azure, and GCP) and the Orchestrator, ensuring stable deployments without requiring live cloud credentials or incurring costs.
Changes Included
moto): Addedmoto[all]to dependencies to simulate an AWS environment locally.test_aws_scanners.pyto verify detection logic for unencrypted buckets, public buckets, and insecure EC2 instances.test_cloud_scanners.pyutilizingpytest-mockto mockComputeManagementClientand GCP'sInstancesClient. Verifies correct parsing of Azure VMs/Storage and GCP Instances.test_orchestrator_e2e.pyto mock all underlying SDKs and test the fullOrchestrator.execute_scan()data aggregation flow..github/workflows/tests.ymlto installmoto[all], ensuring these new tests run perfectly on the GitHub Actions Linux runner.requirements.txtand created.env.exampleso users can easily authenticate if they wish to run real tests.Why This Matters
Achieves complete test coverage of our business logic and prevents future regressions in our cloud scanning code. New contributors can now run
pytestto fully validate their changes instantly without complex cloud setups!