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

chore: Update integration tests #5729

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions integration_tests/prepare_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions integration_tests/test_checkov_cli_integration_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_checkov_ext_module_cloning.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
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")]
for m in expected_private_github_modules:
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"),
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_checkov_platform_only_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down