helper

package
v1.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExitCodeZero represents command exit code 0
	ExitCodeZero = iota
	// ExitCodeOne represents command exit code 1
	ExitCodeOne
	// ExitCodeThree represents command exit code 3
	ExitCodeThree = iota + 1
	// ExitCodeFour represents command exit code 4
	ExitCodeFour
	// ExitCodeFive represents command exit code 5
	ExitCodeFive
)

Variables

This section is empty.

Functions

func CheckSummaryForVulnerabilities

func CheckSummaryForVulnerabilities(session *gexec.Session, expectedCount int)

CheckSummaryForVulnerabilities is a helper function to check vulnerabilities exists

func CompareActualSarifOutputWithGoldenSummaryRegex

func CompareActualSarifOutputWithGoldenSummaryRegex(session *gexec.Session, goldenFileAbsPath string)

CompareActualSarifOutputWithGoldenSummaryRegex compares actual string with contents of golden file passed as parameter ignores specified regex patterns from the actual and golden text

func CompareActualWithGolden

func CompareActualWithGolden(session *gexec.Session, goldenFileAbsPath string, isStdOut bool)

CompareActualWithGolden compares actual string with contents of golden file path passed as parameter

func CompareActualWithGoldenConfigOnlyRegex

func CompareActualWithGoldenConfigOnlyRegex(session *gexec.Session, goldenFileAbsPath string, isStdOut bool)

CompareActualWithGoldenConfigOnlyRegex compares actual string with contents of golden file path passed as parameter

func CompareActualWithGoldenJSON

func CompareActualWithGoldenJSON(session *gexec.Session, goldenFileAbsPath string, isStdOut bool)

CompareActualWithGoldenJSON compares actual data with contents of golden file passed as parameter

func CompareActualWithGoldenJSONString

func CompareActualWithGoldenJSONString(session *gexec.Session, golden string, isStdOut bool)

CompareActualWithGoldenJSONString compares actual data with golden json string passed as parameter

func CompareActualWithGoldenSummaryRegex

func CompareActualWithGoldenSummaryRegex(session *gexec.Session, goldenFileAbsPath string, isJunitXML, isStdOut bool)

CompareActualWithGoldenSummaryRegex compares actual string with contents of golden file passed as parameter ignores specified regex patterns from the actual and golden text

func CompareActualWithGoldenXML

func CompareActualWithGoldenXML(session *gexec.Session, goldenFileAbsPath string, isStdOut bool)

CompareActualWithGoldenXML compares actual data with contents of golden file passed as parameter

func CompareActualWithGoldenYAML

func CompareActualWithGoldenYAML(session *gexec.Session, goldenFileAbsPath string, isStdOut bool)

CompareActualWithGoldenYAML compares actual data with contents of golden file passed as parameter

func CompareSummaryAndViolations

func CompareSummaryAndViolations(sessionEngineOutput, fileDataEngineOutput policy.EngineOutput)

CompareSummaryAndViolations is a helper function to compare actual and expected, summary and violations

func ContainsDirScanErrorSubString

func ContainsDirScanErrorSubString(session *gexec.Session, errSubString string)

ContainsDirScanErrorSubString will assert if dir error substring is part of scan output

func ContainsErrorSubString

func ContainsErrorSubString(session *gexec.Session, errSubString string)

ContainsErrorSubString will assert if error string is part of error output

func DoesNotContainsErrorSubString

func DoesNotContainsErrorSubString(session *gexec.Session, errSubString string)

DoesNotContainsErrorSubString will assert that a string is not part of the error output

func GetAbsoluteFilePathForSarif

func GetAbsoluteFilePathForSarif(resourcePath, filePath string) (string, error)

GetAbsoluteFilePathForSarif helper for sarif path

func GetByteData

func GetByteData(session *gexec.Session, goldenFileAbsPath string, isStdOut bool) ([]byte, []byte)

GetByteData is a helper function to get data in byte slice from session and golden file

func GetTerrascanBinaryPath

func GetTerrascanBinaryPath() string

GetTerrascanBinaryPath returns the terrascan binary path

func RunCommand

func RunCommand(path string, outWriter, errWriter io.Writer, args ...string) *gexec.Session

RunCommand will initialise the command to run and return session

func RunCommandDir

func RunCommandDir(path, workDir string, outWriter, errWriter io.Writer, args ...string) *gexec.Session

RunCommandDir will initialise the command to run in a specific directory and return session

func ValidateDirectoryExists

func ValidateDirectoryExists(path string)

ValidateDirectoryExists validates that a directory exists at the provided path

func ValidateExitCode

func ValidateExitCode(session *gexec.Session, timeout, exitCode int)

ValidateExitCode validates the exit code of a gexec.Session

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL