mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #104172 from atiratree/revert-jsonpath-fix
revert "fix wrong output when using jsonpath"
This commit is contained in:
commit
db4f2014c8
@ -132,9 +132,6 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(results) == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
fullResult = append(fullResult, results)
|
fullResult = append(fullResult, results)
|
||||||
}
|
}
|
||||||
return fullResult, nil
|
return fullResult, nil
|
||||||
|
@ -280,6 +280,7 @@ func TestStructInput(t *testing.T) {
|
|||||||
|
|
||||||
missingKeyTests := []jsonpathTest{
|
missingKeyTests := []jsonpathTest{
|
||||||
{"nonexistent field", "{.hello}", storeData, "", false},
|
{"nonexistent field", "{.hello}", storeData, "", false},
|
||||||
|
{"nonexistent field 2", "before-{.hello}after", storeData, "before-after", false},
|
||||||
}
|
}
|
||||||
testJSONPath(missingKeyTests, true, t)
|
testJSONPath(missingKeyTests, true, t)
|
||||||
|
|
||||||
@ -806,8 +807,8 @@ func TestRunningPodsJSONPathOutput(t *testing.T) {
|
|||||||
testJSONPath(
|
testJSONPath(
|
||||||
[]jsonpathTest{
|
[]jsonpathTest{
|
||||||
{
|
{
|
||||||
"when range is used in a certain way in script, additional line is printed",
|
"range over pods without selecting the last one",
|
||||||
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}`,
|
`{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}{end}`,
|
||||||
data,
|
data,
|
||||||
"pod1 is Running\npod2 is Running\npod3 is Running\n",
|
"pod1 is Running\npod2 is Running\npod3 is Running\n",
|
||||||
false, // expect no error
|
false, // expect no error
|
||||||
|
Loading…
Reference in New Issue
Block a user