mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 22:33:34 +00:00
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
This commit is contained in:
parent
9ff3b7e744
commit
5c3de9f1de
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user