|
| 1 | +Before: |
| 2 | + runtime ale_linters/cloudformation/checkov.vim |
| 3 | + call ale#test#SetFilename('sample.template.yaml') |
| 4 | + |
| 5 | +After: |
| 6 | + call ale#linter#Reset() |
| 7 | + |
| 8 | +Execute(Handle output for no findings correctly): |
| 9 | + AssertEqual |
| 10 | + \ [], |
| 11 | + \ ale_linters#cloudformation#checkov#Handle(bufnr(''), [ |
| 12 | + \'{', |
| 13 | + \' "passed": 0,', |
| 14 | + \' "failed": 0,', |
| 15 | + \' "skipped": 0,', |
| 16 | + \' "parsing_errors": 0,', |
| 17 | + \' "resource_count": 0,', |
| 18 | + \' "checkov_version": "3.2.415"', |
| 19 | + \'}' |
| 20 | + \]) |
| 21 | + |
| 22 | +Execute(Handle output for all tests passed): |
| 23 | + AssertEqual |
| 24 | + \ [], |
| 25 | + \ ale_linters#cloudformation#checkov#Handle(bufnr(''), [ |
| 26 | + \'{', |
| 27 | + \' "check_type": "cloudformation",', |
| 28 | + \' "results": {', |
| 29 | + \' "failed_checks": []', |
| 30 | + \' },', |
| 31 | + \' "summary": {', |
| 32 | + \' "passed": 18,', |
| 33 | + \' "failed": 0,', |
| 34 | + \' "skipped": 0,', |
| 35 | + \' "parsing_errors": 0,', |
| 36 | + \' "resource_count": 3,', |
| 37 | + \' "checkov_version": "3.2.415"', |
| 38 | + \' }', |
| 39 | + \'}' |
| 40 | + \]) |
| 41 | + |
| 42 | +Execute(The JSON output of checkov should be handled correctly): |
| 43 | + AssertEqual |
| 44 | + \ [ |
| 45 | + \ { |
| 46 | + \ 'filename': '/sample.template.yaml', |
| 47 | + \ 'lnum': 57, |
| 48 | + \ 'end_lnum': 79, |
| 49 | + \ 'text': 'Ensure that AWS Lambda function is configured for a Dead Letter Queue(DLQ) [CKV_AWS_116]', |
| 50 | + \ 'detail': "CKV_AWS_116: Ensure that AWS Lambda function is configured for a Dead Letter Queue(DLQ)\n" . |
| 51 | + \ 'For more information, see: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/ensure-that-aws-lambda-function-is-configured-for-a-dead-letter-queue-dlq', |
| 52 | + \ 'type': 'W', |
| 53 | + \ } |
| 54 | + \ ], |
| 55 | + \ ale_linters#cloudformation#checkov#Handle(bufnr(''), [ |
| 56 | + \'{', |
| 57 | + \' "check_type": "cloudformation",', |
| 58 | + \' "results": {', |
| 59 | + \' "failed_checks": [', |
| 60 | + \' {', |
| 61 | + \' "check_id": "CKV_AWS_116",', |
| 62 | + \' "bc_check_id": "BC_AWS_GENERAL_64",', |
| 63 | + \' "check_name": "Ensure that AWS Lambda function is configured for a Dead Letter Queue(DLQ)",', |
| 64 | + \' "check_result": {', |
| 65 | + \' "result": "FAILED",', |
| 66 | + \' "evaluated_keys": [', |
| 67 | + \' "Properties/DeadLetterQueue/TargetArn"', |
| 68 | + \' ]', |
| 69 | + \' },', |
| 70 | + \' "file_path": "/sample.template.yaml",', |
| 71 | + \' "repo_file_path": "/sample.template.yaml",', |
| 72 | + \' "file_line_range": [', |
| 73 | + \' 57,', |
| 74 | + \' 79', |
| 75 | + \' ],', |
| 76 | + \' "resource": "AWS::Serverless::Function.FunctionName",', |
| 77 | + \' "evaluations": {},', |
| 78 | + \' "check_class": "checkov.cloudformation.checks.resource.aws.LambdaDLQConfigured",', |
| 79 | + \' "entity_tags": null,', |
| 80 | + \' "resource_address": null,', |
| 81 | + \' "guideline": "https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/ensure-that-aws-lambda-function-is-configured-for-a-dead-letter-queue-dlq"', |
| 82 | + \' }', |
| 83 | + \' ]', |
| 84 | + \' }', |
| 85 | + \'}' |
| 86 | + \ ]) |