From 5e6ae674dad735674430fc1492fa0b4413ac75cd Mon Sep 17 00:00:00 2001 From: Saar Ettinger Date: Tue, 7 Nov 2023 16:56:20 +0200 Subject: [PATCH] Update integration tests --- integration_tests/prepare_data.sh | 10 +++++----- integration_tests/run_integration_tests.sh | 8 ++++---- .../test_checkov_cli_integration_report.py | 6 +++--- integration_tests/test_checkov_ext_module_cloning.py | 4 ++-- .../test_checkov_platform_only_policies.py | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/integration_tests/prepare_data.sh b/integration_tests/prepare_data.sh index 6cd8c59ba4d..845536a768c 100755 --- a/integration_tests/prepare_data.sh +++ b/integration_tests/prepare_data.sh @@ -31,12 +31,12 @@ fi if [[ "$2" == "3.8" && "$1" == "ubuntu-latest" ]] then - pipenv run checkov -s -f terragoat/terraform/aws/s3.tf --bc-api-key $BC_KEY > checkov_report_s3_singlefile_api_key_terragoat.txt - pipenv run checkov -s -d terragoat/terraform/azure/ --bc-api-key $BC_KEY > checkov_report_azuredir_api_key_terragoat.txt - pipenv run checkov -s -d terragoat/terraform/azure/ --skip-results-upload --bc-api-key $BC_KEY > checkov_report_azuredir_api_key_terragoat_no_upload.txt + pipenv run checkov -s -f terragoat/terraform/aws/s3.tf --repo-id checkov/integration_test --bc-api-key $BC_KEY > checkov_report_s3_singlefile_api_key_terragoat.txt + pipenv run checkov -s -d terragoat/terraform/azure/ --repo-id checkov/integration_test --bc-api-key $BC_KEY > checkov_report_azuredir_api_key_terragoat.txt + pipenv run checkov -s -d terragoat/terraform/azure/ --repo-id checkov/integration_test --skip-results-upload --bc-api-key $BC_KEY > checkov_report_azuredir_api_key_terragoat_no_upload.txt echo "running image referencing" - pipenv run checkov -s -d integration_tests/example_workflow_file/.github/workflows/ -o json --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_workflow_cve.json - pipenv run checkov -s -d integration_tests/example_workflow_file/bitbucket/ -o json --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_bitbucket_pipelines_cve.json + pipenv run checkov -s -d integration_tests/example_workflow_file/.github/workflows/ -o json --repo-id checkov/integration_test --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_workflow_cve.json + pipenv run checkov -s -d integration_tests/example_workflow_file/bitbucket/ -o json --repo-id checkov/integration_test --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_bitbucket_pipelines_cve.json echo "running list" pipenv run checkov --list --bc-api-key $BC_KEY --output-bc-ids > checkov_checks_list.txt echo "running tfc" diff --git a/integration_tests/run_integration_tests.sh b/integration_tests/run_integration_tests.sh index 2125e3f39f4..fe3b247d8d5 100755 --- a/integration_tests/run_integration_tests.sh +++ b/integration_tests/run_integration_tests.sh @@ -22,10 +22,10 @@ prepare_data () { python checkov/main.py -s --framework cloudformation -d repositories/cfngoat/ -o json --quiet > checkov_report_cfngoat_quiet.json python checkov/main.py -s -d repositories/terragoat/terraform/ --config-file integration_tests/example_config_files/config.yaml -o json > checkov_config_report_terragoat.json - python checkov/main.py -s -f repositories/terragoat/terraform/aws/s3.tf --bc-api-key $BC_KEY > checkov_report_s3_singlefile_api_key_terragoat.txt - python checkov/main.py -s -d repositories/terragoat/terraform/azure/ --bc-api-key $BC_KEY > checkov_report_azuredir_api_key_terragoat.txt - python checkov/main.py -s -d integration_tests/example_workflow_file/.github/workflows/ -o json --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_workflow_cve.json - python checkov/main.py -s -d integration_tests/example_workflow_file/bitbucket/ -o json --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_bitbucket_pipelines_cve.json + python checkov/main.py -s -f repositories/terragoat/terraform/aws/s3.tf --repo-id checkov/integration_test --bc-api-key $BC_KEY > checkov_report_s3_singlefile_api_key_terragoat.txt + python checkov/main.py -s -d repositories/terragoat/terraform/azure/ --repo-id checkov/integration_test --bc-api-key $BC_KEY > checkov_report_azuredir_api_key_terragoat.txt + python checkov/main.py -s -d integration_tests/example_workflow_file/.github/workflows/ -o json --repo-id checkov/integration_test --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_workflow_cve.json + python checkov/main.py -s -d integration_tests/example_workflow_file/bitbucket/ -o json --repo-id checkov/integration_test --bc-api-key $BC_KEY --include-all-checkov-policies > checkov_report_bitbucket_pipelines_cve.json python checkov/main.py --list --bc-api-key $BC_KEY --output-bc-ids > checkov_checks_list.txt } diff --git a/integration_tests/test_checkov_cli_integration_report.py b/integration_tests/test_checkov_cli_integration_report.py index d594bae1ec3..36f92b3d0c6 100644 --- a/integration_tests/test_checkov_cli_integration_report.py +++ b/integration_tests/test_checkov_cli_integration_report.py @@ -21,7 +21,7 @@ def test_terragoat_report_file_api_key(self): self.validate_report(os.path.abspath(report_path)) def validate_report(self, report_path, url_should_exist=True): - if sys.version_info[1] == 7 and platform.system() == 'Linux': + if sys.version_info[1] == 8 and platform.system() == 'Linux': platform_url_found = False with open(report_path) as f: if 'More details: https://www.bridgecrew.cloud/projects?' in f.read(): @@ -30,7 +30,7 @@ def validate_report(self, report_path, url_should_exist=True): def test_workflow_report_api_key(self): report_path = os.path.join(current_dir, '..', 'checkov_report_workflow_cve.json') - if sys.version_info[1] == 7 and platform.system() == 'Linux': + 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, @@ -49,7 +49,7 @@ def test_workflow_report_api_key(self): def test_bitbucket_pipelines_report_api_key(self): report_path = os.path.join(current_dir, '..', 'checkov_report_bitbucket_pipelines_cve.json') - if sys.version_info[1] == 7 and platform.system() == 'Linux': + 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, diff --git a/integration_tests/test_checkov_ext_module_cloning.py b/integration_tests/test_checkov_ext_module_cloning.py index 981d86783a0..c3ef4be2ddb 100644 --- a/integration_tests/test_checkov_ext_module_cloning.py +++ b/integration_tests/test_checkov_ext_module_cloning.py @@ -10,7 +10,7 @@ class TestCheckovExtModuleCloning(unittest.TestCase): def test_private_github_modules_api_key(self): - if sys.version_info[1] == 7 and platform.system() == 'Linux' and False: + if sys.version_info[1] == 8 and platform.system() == 'Linux' and False: expected_private_github_path = os.path.join(ext_modules_path, "github.com", "ckv-tests") expected_private_github_modules = [os.path.join(expected_private_github_path, "terraform-aws-iam-s3-user-private"), os.path.join(expected_private_github_path, "terraform-aws-s3-bucket-private")] @@ -18,7 +18,7 @@ def test_private_github_modules_api_key(self): assert os.path.exists(m) def test_private_tfc_modules_api_key(self): - if sys.version_info[1] == 7 and platform.system() == 'Linux' and False: + if sys.version_info[1] == 8 and platform.system() == 'Linux' and False: expected_private_tfc_path = os.path.join(ext_modules_path, "app.terraform.io", "panw-bridgecrew") expected_private_tfc_modules = [ os.path.join(expected_private_tfc_path, "iam-s3-user", "aws", "0.15.7"), diff --git a/integration_tests/test_checkov_platform_only_policies.py b/integration_tests/test_checkov_platform_only_policies.py index 84eecea01c5..18f1d6b402a 100644 --- a/integration_tests/test_checkov_platform_only_policies.py +++ b/integration_tests/test_checkov_platform_only_policies.py @@ -13,7 +13,7 @@ class TestCheckovPlatformOnlyPolicies(unittest.TestCase): def test_no_ckv_ids_api_key(self): checks_list_path = current_dir.parent / 'checkov_checks_list.txt' - if sys.version_info[1] == 7 and platform.system() == 'Linux': + if sys.version_info[1] == 8 and platform.system() == 'Linux': with open(checks_list_path, encoding='utf-8') as f: for i, line in enumerate(f): if i in [0, 1]: