Skip to content

Commit 67fba22

Browse files
atiratreek8s-publishing-bot
authored andcommitted
revert "fix wrong output when using jsonpath"
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
1 parent 4d7bb68 commit 67fba22

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

util/jsonpath/jsonpath.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
132132
}
133133
continue
134134
}
135-
if len(results) == 0 {
136-
break
137-
}
138135
fullResult = append(fullResult, results)
139136
}
140137
return fullResult, nil

util/jsonpath/jsonpath_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,8 @@ func TestRunningPodsJSONPathOutput(t *testing.T) {
806806
testJSONPath(
807807
[]jsonpathTest{
808808
{
809-
"when range is used in a certain way in script, additional line is printed",
810-
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}`,
809+
"range over pods without selecting the last one",
810+
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}{end}`,
811811
data,
812812
"pod1 is Running\npod2 is Running\npod3 is Running\n",
813813
false, // expect no error

0 commit comments

Comments
 (0)