(t *testing.T)
| 524 | } |
| 525 | |
| 526 | func TestStep(t *testing.T) { |
| 527 | var input = []byte( |
| 528 | `{ |
| 529 | "apiVersion": "v1", |
| 530 | "kind": "Pod", |
| 531 | "spec": { |
| 532 | "containers": [ |
| 533 | { |
| 534 | "image": "radial/busyboxplus:curl", |
| 535 | "name": "fake0" |
| 536 | }, |
| 537 | { |
| 538 | "image": "radial/busyboxplus:curl", |
| 539 | "name": "fake1" |
| 540 | }, |
| 541 | { |
| 542 | "image": "radial/busyboxplus:curl", |
| 543 | "name": "fake2" |
| 544 | }, |
| 545 | { |
| 546 | "image": "radial/busyboxplus:curl", |
| 547 | "name": "fake3" |
| 548 | }, |
| 549 | { |
| 550 | "image": "radial/busyboxplus:curl", |
| 551 | "name": "fake4" |
| 552 | }, |
| 553 | { |
| 554 | "image": "radial/busyboxplus:curl", |
| 555 | "name": "fake5" |
| 556 | }]}}`) |
| 557 | |
| 558 | var data interface{} |
| 559 | err := json.Unmarshal(input, &data) |
| 560 | if err != nil { |
| 561 | t.Fatal(err) |
| 562 | } |
| 563 | |
| 564 | testJSONPath( |
| 565 | []jsonpathTest{ |
| 566 | { |
| 567 | "test containers[0:], it equals containers[0:6:1]", |
| 568 | `{.spec.containers[0:].name}`, |
| 569 | data, |
| 570 | "fake0 fake1 fake2 fake3 fake4 fake5", |
| 571 | false, |
| 572 | }, |
| 573 | { |
| 574 | "test containers[0:6:], it equals containers[0:6:1]", |
| 575 | `{.spec.containers[0:6:].name}`, |
| 576 | data, |
| 577 | "fake0 fake1 fake2 fake3 fake4 fake5", |
| 578 | false, |
| 579 | }, |
| 580 | { |
| 581 | "test containers[0:6:1]", |
| 582 | `{.spec.containers[0:6:1].name}`, |
| 583 | data, |
nothing calls this directly
no test coverage detected