Skip to content

Commit

Permalink
revert "fix wrong output when using jsonpath"
Browse files Browse the repository at this point in the history
This partially reverts commit 39cfe232325d66bcdbc935af7aaf7022562e7010and PR #98057

the original problem was caused by not using {end} at the end of the range

Kubernetes-commit: 846910acab49681542a028668ebb818bf90df535
  • Loading branch information
atiratree authored and k8s-publishing-bot committed Aug 5, 2021
1 parent 4d7bb68 commit 67fba22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions util/jsonpath/jsonpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions util/jsonpath/jsonpath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,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
Expand Down

0 comments on commit 67fba22

Please sign in to comment.