MCPcopy
hub / github.com/kubernetes/client-go / TestStep

Function TestStep

util/jsonpath/jsonpath_test.go:526–654  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

524}
525
526func 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,

Callers

nothing calls this directly

Calls 1

testJSONPathFunction · 0.85

Tested by

no test coverage detected