Skip to content

Conversation

@prajwal-choudhari-comprinno

This PR introduces unit test coverage for the cloudtrail_cloudwatch_logging_enabled check, ensuring its behavior is validated across multiple CloudTrail trail configurations.

Description

These tests confirm the check's response when:

  • No trails exist
  • Trails are configured correctly with CloudWatch logging
  • Trails are missing CloudWatch logging
  • AWS API access fails (ClientError)
  • Added a dedicated test class TestCloudTrailCloudWatchLoggingEnabled

Checklist

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

)
report = self.check.execute(self.mock_session)
assert report.status == CheckStatus.UNKNOWN
assert report.resource_ids_status[0].summary == "Error retrieving CloudTrail details."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your test test_cloudwatch_logging_enabled has only the log group ARN but not the role ARN, so it's incorrectly expected to pass.

Add a test case with both compliant and non-compliant trails to validate cumulative status logic (FAILED if any fail).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants