Merge pull request #104172 from atiratree/revert-jsonpath-fix

revert "fix wrong output when using jsonpath"
This commit is contained in:
Kubernetes Prow Robot 2021-08-31 07:41:37 -07:00 committed by GitHub
commit db4f2014c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -132,9 +132,6 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
}
continue
}
if len(results) == 0 {
break
}
fullResult = append(fullResult, results)
}
return fullResult, nil

View File

@ -280,6 +280,7 @@ func TestStructInput(t *testing.T) {
missingKeyTests := []jsonpathTest{
{"nonexistent field", "{.hello}", storeData, "", false},
{"nonexistent field 2", "before-{.hello}after", storeData, "before-after", false},
}
testJSONPath(missingKeyTests, true, t)
@ -806,8 +807,8 @@ func TestRunningPodsJSONPathOutput(t *testing.T) {
testJSONPath(
[]jsonpathTest{
{
"when range is used in a certain way in script, additional line is printed",
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}`,
"range over pods without selecting the last one",
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}{end}`,
data,
"pod1 is Running\npod2 is Running\npod3 is Running\n",
false, // expect no error