diff --git a/api_testsuite.go b/api_testsuite.go index 2aa48f9..30ef522 100644 --- a/api_testsuite.go +++ b/api_testsuite.go @@ -230,16 +230,14 @@ func (ats *Suite) parseAndRunTest(v any, manifestDir, testFilePath string, k, re // Get the (optional) number of repititions from the test path spec isParallelPathSpec := false parallelRepititions := 1 - if isParallelPathSpec { - switch t := v.(type) { - case string: - parallelRepititions, _ = util.GetParallelPathSpec(t) - - // FIXME - Shouldn't this be > 1 (also in util.IsParallelPathSpec)? - // If so, the declaration in L.6 can be removed and this can be turned - // into a declaration and moved to after the if block. - isParallelPathSpec = parallelRepititions > 0 - } + switch t := v.(type) { + case string: + parallelRepititions, _ = util.GetParallelPathSpec(t) + + // FIXME - Shouldn't this be > 1 (also in util.IsParallelPathSpec)? + // If so, the declaration in L.6 can be removed and this can be turned + // into a declaration and moved to after the if block. + isParallelPathSpec = parallelRepititions > 0 } //Get the Manifest with @ logic @@ -255,21 +253,13 @@ func (ats *Suite) parseAndRunTest(v any, manifestDir, testFilePath string, k, re } // Parse as template always - requestBytes, lErr := loader.Render(testObj, filepath.Join(manifestDir, dir), nil) - if lErr != nil { - r.SaveToReportLog(lErr.Error()) - logrus.Error(fmt.Errorf("can not render template (%s): %s", testFilePath, lErr)) + testObj, err = loader.Render(testObj, filepath.Join(manifestDir, dir), nil) + if err != nil { + r.SaveToReportLog(err.Error()) + logrus.Error(fmt.Errorf("can not render template (%s): %s", testFilePath, err)) return false } - // If objects are different, we did have a Go template, recurse one level deep - if string(requestBytes) != string(testObj) { - return ats.parseAndRunTest([]byte(requestBytes), filepath.Join(manifestDir, dir), - testFilePath, k, parallelRepititions, isParallelPathSpec, r, loader) - } - - testObj = requestBytes - //Try to directly unmarshal the manifest into testcase array var testCases []json.RawMessage err = util.Unmarshal(testObj, &testCases)