MCPcopy Create free account
hub / github.com/zalando/skipper / TestParseAnnotationConfig

Function TestParseAnnotationConfig

config/config_test.go:656–790  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

654}
655
656func TestParseAnnotationConfig(t *testing.T) {
657 t.Run("parseAnnotationPredicates", func(t *testing.T) {
658
659 for _, tc := range []struct {
660 name string
661 input []string
662 expected []kubernetes.AnnotationPredicates
663 }{
664 {
665 name: "empty",
666 input: []string{},
667 expected: nil,
668 },
669 {
670 name: "empty string",
671 input: []string{""},
672 expected: nil,
673 },
674 {
675 name: "empty string and a valid value",
676 input: []string{
677 "",
678 `to-add-predicate=true=Foo("123")`,
679 },
680 expected: []kubernetes.AnnotationPredicates{
681 {
682 Key: "to-add-predicate",
683 Value: "true",
684 Predicates: eskip.MustParsePredicates(`Foo("123")`),
685 },
686 },
687 },
688 {
689 name: "single",
690 input: []string{`to-add-predicate=true=Foo("123")`},
691 expected: []kubernetes.AnnotationPredicates{
692 {
693 Key: "to-add-predicate",
694 Value: "true",
695 Predicates: eskip.MustParsePredicates(`Foo("123")`),
696 },
697 },
698 },
699 {
700 name: "multiple",
701 input: []string{`to-add-predicate=true=Foo("123")`, `to-add-predicate=false=Bar("456") && Foo("789")`},
702 expected: []kubernetes.AnnotationPredicates{
703 {
704 Key: "to-add-predicate",
705 Value: "true",
706 Predicates: eskip.MustParsePredicates(`Foo("123")`),
707 },
708 {
709 Key: "to-add-predicate",
710 Value: "false",
711 Predicates: eskip.MustParsePredicates(`Bar("456") && Foo("789")`),
712 },
713 },

Callers

nothing calls this directly

Calls 4

MustParsePredicatesFunction · 0.92
MustParseFiltersFunction · 0.92
parseAnnotationFiltersFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…