Skip to content
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

fix(general): bitbucket integration test failure #6407

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions integration_tests/test_checkov_cli_integration_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,18 @@ def validate_report(self, report_path, url_should_exist=True):

def test_bitbucket_pipelines_report_api_key(self):
report_path = os.path.join(current_dir, '..', 'checkov_report_bitbucket_pipelines_cve.json')
# the below condition exist because checkov_report_bitbucket_pipelines_cve.json is
# generated only on Linux with Python 3.8 - see prepare_data.sh script
if sys.version_info[1] == 8 and platform.system() == 'Linux':
with open(report_path, encoding='utf-8') as f:
reports = json.load(f)
self.assertGreaterEqual(len(reports), 2,
"expecting to have 2 reports at least, bitbucket_pipelines and sca_image")
report = json.load(f)
self.assertGreaterEqual(len(report), 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old file format - array of 2 dicts :

[
   {"check_type": "bitbucket_pipeliens"...}.
    {"check_type": "sca_image"...}.
]

Modified file format - single dict:

{"check_type": "bitbucket_pipeliens"...}

"expecting to have one report at least - bitbucket_pipelines ")
bitbucket_pipelines_actions_report_exists = False
sca_image = False
for report in reports:
if report["check_type"] == "bitbucket_pipelines":
bitbucket_pipelines_actions_report_exists = True
self.assertGreaterEqual(report['summary']['failed'], 1)
if report["check_type"] == "sca_image":
sca_image = True
self.assertGreaterEqual(report['summary']['failed'], 1)
self.assertTrue(sca_image)
if report["check_type"] == "bitbucket_pipelines":
bitbucket_pipelines_actions_report_exists = True
self.assertGreaterEqual(report['summary']['failed'], 1)

self.assertTrue(bitbucket_pipelines_actions_report_exists)


Expand Down
Loading