summaryrefslogtreecommitdiff
path: root/test/handler/test_checkov_handler.vader
blob: 9884113c60981b774d560aa6b84d2b6ce548db01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Before:
  runtime ale_linters/terraform/checkov.vim
  call ale#test#SetFilename('main.tf')

After:
  call ale#linter#Reset()

Execute(The JSON output of checkov should be handled correctly):
  AssertEqual
  \ [
  \   {
  \         'filename': '/main.tf',
  \         'lnum': 22,
  \         'end_lnum': 27,
  \         'text': 'Enable VPC Flow Logs and Intranode Visibility [CKV_GCP_61]',
  \         'detail': "CKV_GCP_61: Enable VPC Flow Logs and Intranode Visibility\n" .
  \                   'For more information, see: https://docs.bridgecrew.io/docs/enable-vpc-flow-logs-and-intranode-visibility',
  \         'type': 'W',
  \   }
  \ ],
  \ ale_linters#terraform#checkov#Handle(bufnr(''), [
  \'{',
  \'    "check_type": "terraform",',
  \'    "results": {',
  \'        "failed_checks": [',
  \'            {',
  \'                "check_id": "CKV_GCP_61",',
  \'                "bc_check_id": "BC_GCP_KUBERNETES_18",',
  \'                "check_name": "Enable VPC Flow Logs and Intranode Visibility",',
  \'                "check_result": {',
  \'                    "result": "FAILED",',
  \'                    "evaluated_keys": [',
  \'                        "enable_intranode_visibility"',
  \'                    ]',
  \'                },',
  \'                "file_path": "/main.tf",',
  \'                "repo_file_path": "/main.tf",',
  \'                "file_line_range": [',
  \'                    22,',
  \'                    27',
  \'                ],',
  \'                "resource": "google_container_cluster.cluster-name",',
  \'                "evaluations": null,',
  \'                "check_class": "checkov.terraform.checks.resource.gcp.GKEEnableVPCFlowLogs",',
  \'                "entity_tags": null,',
  \'                "resource_address": null,',
  \'                "guideline": "https://docs.bridgecrew.io/docs/enable-vpc-flow-logs-and-intranode-visibility"',
  \'            }',
  \'        ]',
  \'    }',
  \'}'
  \ ])

Execute(Handle output for no findings correctly):
  AssertEqual
  \ [],
  \ ale_linters#terraform#checkov#Handle(bufnr(''), [
  \'{',
  \'    "passed": 0,',
  \'    "failed": 0,',
  \'    "skipped": 0,',
  \'    "parsing_errors": 0,',
  \'    "resource_count": 0,',
  \'    "checkov_version": "2.0.632"',
  \'}'
  \])