updates to execute func in integration-test.go

This commit is contained in:
LuitelSamikshya 2022-10-13 11:05:10 -05:00
parent 2456121e1a
commit 909aa4cd79

View File

@ -62,7 +62,7 @@ func runTests(customTemplatePaths map[string]struct{}) map[string]struct{} {
for templatePath, testCase := range testCases { for templatePath, testCase := range testCases {
if len(customTemplatePaths) == 0 || contains(customTemplatePaths, templatePath) { if len(customTemplatePaths) == 0 || contains(customTemplatePaths, templatePath) {
if err, failedTemplatePath := execute(testCase, templatePath); err != nil { if failedTemplatePath, err := execute(testCase, templatePath); err != nil {
failedTestTemplatePaths[failedTemplatePath] = struct{}{} failedTestTemplatePaths[failedTemplatePath] = struct{}{}
} }
} }
@ -72,14 +72,14 @@ func runTests(customTemplatePaths map[string]struct{}) map[string]struct{} {
return failedTestTemplatePaths return failedTestTemplatePaths
} }
func execute(testCase testutils.TestCase, templatePath string) (error, string) { func execute(testCase testutils.TestCase, templatePath string) (string, error) {
if err := testCase.Execute(templatePath); err != nil { if err := testCase.Execute(templatePath); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%s Test \"%s\" failed: %s\n", failed, templatePath, err) _, _ = fmt.Fprintf(os.Stderr, "%s Test \"%s\" failed: %s\n", failed, templatePath, err)
return err, templatePath return templatePath, err
} }
fmt.Printf("%s Test \"%s\" passed!\n", success, templatePath) fmt.Printf("%s Test \"%s\" passed!\n", success, templatePath)
return nil, "" return "", nil
} }
func expectResultsCount(results []string, expectedNumber int) error { func expectResultsCount(results []string, expectedNumber int) error {