Skip to content

Commit

Permalink
Merge pull request #1648 from snyk/refactor/iac-test-documentation
Browse files Browse the repository at this point in the history
refactor: iac test docs
  • Loading branch information
rontalx committed Feb 22, 2021
2 parents 23a8655 + 9036298 commit 3775fcd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/lib/errors/invalid-iac-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function NotSupportedIacFileErrorMsg(fileName: string): string {
return (
'Not supported infrastructure as code target files in ' +
fileName +
'.\nPlease see our documentation for supported target files (currently we support Kubernetes files only): ' +
'.\nPlease see our documentation for supported target files: ' +
chalk.underline(
'https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files',
) +
Expand All @@ -17,7 +17,7 @@ export function IllegalIacFileErrorMsg(fileName: string): string {
return (
'Illegal infrastructure as code target file ' +
fileName +
'.\nPlease see our documentation for supported target files (currently we support Kubernetes files only): ' +
'.\nPlease see our documentation for supported target files: ' +
chalk.underline(
'https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files',
) +
Expand Down Expand Up @@ -55,9 +55,9 @@ export function IllegalTerraformFileError(
const locationsStr = atLocations.join(', ');
const errorMsg =
`Illegal Terraform target file ${locationsStr} \nValidation Error Reason: ${reason}` +
'.\nPlease see our documentation for supported target files (currently we support Kubernetes files only): ' +
'.\nPlease see our documentation for supported target files: ' +
chalk.underline(
'https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files',
'https://support.snyk.io/hc/en-us/articles/360013723877-Test-your-Terraform-files-with-our-CLI-tool',
) +
' and make sure you are in the right directory.';

Expand Down
16 changes: 2 additions & 14 deletions test/smoke/spec/iac/snyk_test_directory_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@ Describe "Snyk iac test command"

The output should include "Tested sg_open_ssh.tf for known issues, found"

# Invalid File testing - Go Template
The output should include "Testing sg_open_ssh_invalid_go_templates.tf..."
The output should include "Illegal Terraform target file sg_open_ssh_invalid_go_templates.tf "
The output should include "Validation Error Reason: Go Template placeholders found in Terraform file."
The output should include "Please see our documentation for supported target files (currently we support Kubernetes files only): https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files and make sure you are in the right directory."

# Invalid File testing - HCL2 Format
The output should include "Testing sg_open_ssh_invalid_hcl2.tf..."
The output should include "Illegal Terraform target file sg_open_ssh_invalid_hcl2.tf"
The output should include "Validation Error Reason: Invalid HCL2 Format."
The output should include "Please see our documentation for supported target files (currently we support Kubernetes files only): https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files and make sure you are in the right directory."
The output should include "Please see our documentation for supported target files: https://support.snyk.io/hc/en-us/articles/360013723877-Test-your-Terraform-files-with-our-CLI-tool and make sure you are in the right directory."
End

It "filters out issues when using severity threshold"
Expand All @@ -55,17 +49,11 @@ Describe "Snyk iac test command"

The output should include "Tested sg_open_ssh.tf for known issues, found"

# Invalid File testing - Go Template
The output should include "Testing sg_open_ssh_invalid_go_templates.tf..."
The output should include "Illegal Terraform target file sg_open_ssh_invalid_go_templates.tf "
The output should include "Validation Error Reason: Go Template placeholders found in Terraform file."
The output should include "Please see our documentation for supported target files (currently we support Kubernetes files only): https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files and make sure you are in the right directory."

# Invalid File testing - HCL2 Format
The output should include "Testing sg_open_ssh_invalid_hcl2.tf..."
The output should include "Illegal Terraform target file sg_open_ssh_invalid_hcl2.tf"
The output should include "Validation Error Reason: Invalid HCL2 Format."
The output should include "Please see our documentation for supported target files (currently we support Kubernetes files only): https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files and make sure you are in the right directory."
The output should include "Please see our documentation for supported target files: https://support.snyk.io/hc/en-us/articles/360013723877-Test-your-Terraform-files-with-our-CLI-tool and make sure you are in the right directory."
End

It "outputs the expected text when running with --sarif flag"
Expand Down
7 changes: 0 additions & 7 deletions test/smoke/spec/iac/snyk_test_terraform_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ Describe "Snyk iac test command"
The output should include "Validation Error Reason: Invalid HCL2 Format."
End

It "outputs an error for invalid tf files with go templates"
When run snyk iac test ../fixtures/iac/terraform/sg_open_ssh_invalid_go_templates.tf
The status should be failure
The output should include "Illegal Terraform target file sg_open_ssh_invalid_go_templates.tf"
The output should include "Validation Error Reason: Go Template placeholders found in Terraform file."
End

It "outputs the expected text when running with --sarif flag"
When run snyk iac test ../fixtures/iac/terraform/sg_open_ssh.tf --sarif
The status should be failure
Expand Down

0 comments on commit 3775fcd

Please sign in to comment.