@@ -769,16 +769,20 @@ func TestFilterByPattern(t *testing.T) {
769
769
input : NewSet (
770
770
MakePathOrDie ("spec" ),
771
771
MakePathOrDie ("spec" , "containers" ),
772
+ MakePathOrDie ("spec" , "containers" , 0 ),
772
773
MakePathOrDie ("spec" , "containers" , 0 , "resources" ),
773
774
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "limits" ),
774
775
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "limits" , "cpu" ),
775
776
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "requests" ),
776
777
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "requests" , "cpu" ),
777
778
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" ),
779
+ MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 0 ),
778
780
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 0 , "name" ),
779
781
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 0 , "request" ),
782
+ MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 1 ),
780
783
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 1 , "name" ),
781
784
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 1 , "request" ),
785
+ MakePathOrDie ("spec" , "containers" , 1 ),
782
786
MakePathOrDie ("spec" , "containers" , 1 , "resources" ),
783
787
MakePathOrDie ("spec" , "containers" , 1 , "resources" , "limits" ),
784
788
MakePathOrDie ("spec" , "containers" , 1 , "resources" , "limits" , "cpu" ),
@@ -787,16 +791,20 @@ func TestFilterByPattern(t *testing.T) {
787
791
expect : NewSet (
788
792
MakePathOrDie ("spec" ),
789
793
MakePathOrDie ("spec" , "containers" ),
794
+ MakePathOrDie ("spec" , "containers" , 0 ),
790
795
MakePathOrDie ("spec" , "containers" , 0 , "resources" ),
791
796
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "limits" ),
792
797
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "limits" , "cpu" ),
793
798
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "requests" ),
794
799
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "requests" , "cpu" ),
795
800
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" ),
801
+ MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 0 ),
796
802
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 0 , "name" ),
797
803
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 0 , "request" ),
804
+ MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 1 ),
798
805
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 1 , "name" ),
799
806
MakePathOrDie ("spec" , "containers" , 0 , "resources" , "claims" , 1 , "request" ),
807
+ MakePathOrDie ("spec" , "containers" , 1 ),
800
808
MakePathOrDie ("spec" , "containers" , 1 , "resources" ),
801
809
MakePathOrDie ("spec" , "containers" , 1 , "resources" , "limits" ),
802
810
MakePathOrDie ("spec" , "containers" , 1 , "resources" , "limits" , "cpu" ),
@@ -831,6 +839,7 @@ func TestFilterByPattern(t *testing.T) {
831
839
input : NewSet (
832
840
MakePathOrDie ("spec" ),
833
841
MakePathOrDie ("spec" , "containers" ),
842
+ MakePathOrDie ("spec" , "containers" , 0 ),
834
843
MakePathOrDie ("spec" , "containers" , 0 , "image" ),
835
844
MakePathOrDie ("spec" , "containers" , 0 , "workingDir" ),
836
845
MakePathOrDie ("spec" , "containers" , 0 , "resources" ),
@@ -839,6 +848,7 @@ func TestFilterByPattern(t *testing.T) {
839
848
expect : NewSet (
840
849
MakePathOrDie ("spec" ),
841
850
MakePathOrDie ("spec" , "containers" ),
851
+ MakePathOrDie ("spec" , "containers" , 0 ),
842
852
MakePathOrDie ("spec" , "containers" , 0 , "resources" ),
843
853
),
844
854
},
@@ -880,44 +890,6 @@ func TestFilterByPattern(t *testing.T) {
880
890
}, "field" ),
881
891
),
882
892
},
883
- {
884
- name : "filter listMap key" ,
885
- input : NewSet (
886
- MakePathOrDie ("spec" ),
887
- MakePathOrDie ("spec" , "listMap" ,
888
- & value.FieldList {
889
- {Name : "key1" , Value : value .NewValueInterface ("value1" )},
890
- {Name : "key2" , Value : value .NewValueInterface ("value2" )},
891
- }),
892
- MakePathOrDie ("spec" , "listMap" ,
893
- & value.FieldList {
894
- {Name : "key1" , Value : value .NewValueInterface ("value1" )},
895
- {Name : "key2" , Value : value .NewValueInterface ("value2" )},
896
- }, "field" ),
897
- MakePathOrDie ("spec" , "listMap" ,
898
- & value.FieldList {
899
- {Name : "key1" , Value : value .NewValueInterface ("valueX" )},
900
- {Name : "key2" , Value : value .NewValueInterface ("valueY" )},
901
- }, "field" ),
902
- ),
903
- filter : NewIncludeMatcherFilter (MakePrefixMatcherOrDie ("spec" , "listMap" , & value.FieldList {
904
- {Name : "key1" , Value : value .NewValueInterface ("value1" )},
905
- {Name : "key2" , Value : value .NewValueInterface ("value2" )},
906
- })),
907
- expect : NewSet (
908
- MakePathOrDie ("spec" ),
909
- MakePathOrDie ("spec" , "listMap" ,
910
- & value.FieldList {
911
- {Name : "key1" , Value : value .NewValueInterface ("value1" )},
912
- {Name : "key2" , Value : value .NewValueInterface ("value2" )},
913
- }),
914
- MakePathOrDie ("spec" , "listMap" ,
915
- & value.FieldList {
916
- {Name : "key1" , Value : value .NewValueInterface ("value1" )},
917
- {Name : "key2" , Value : value .NewValueInterface ("value2" )},
918
- }, "field" ),
919
- ),
920
- },
921
893
{
922
894
name : "filter value" ,
923
895
input : NewSet (
@@ -935,55 +907,80 @@ func TestFilterByPattern(t *testing.T) {
935
907
name : "filter by index" ,
936
908
input : NewSet (
937
909
MakePathOrDie ("spec" ),
910
+ MakePathOrDie ("spec" , "list" ),
911
+ MakePathOrDie ("spec" , "list" , 0 ),
938
912
MakePathOrDie ("spec" , "list" , 0 , "value" ),
913
+ MakePathOrDie ("spec" , "list" , 1 ),
939
914
MakePathOrDie ("spec" , "list" , 1 , "value" ),
940
915
),
941
916
filter : NewIncludeMatcherFilter (MakePrefixMatcherOrDie ("spec" , "list" , 1 , "value" )),
942
917
expect : NewSet (
943
918
MakePathOrDie ("spec" ),
919
+ MakePathOrDie ("spec" , "list" ),
920
+ MakePathOrDie ("spec" , "list" , 1 ),
944
921
MakePathOrDie ("spec" , "list" , 1 , "value" ),
945
922
),
946
923
},
947
924
{
948
925
name : "multiple index matchers" ,
949
926
input : NewSet (
950
927
MakePathOrDie ("spec" ),
928
+ MakePathOrDie ("spec" , "list" ),
929
+ MakePathOrDie ("spec" , "list" , 0 ),
951
930
MakePathOrDie ("spec" , "list" , 0 , "value" ),
931
+ MakePathOrDie ("spec" , "list" , 1 ),
952
932
MakePathOrDie ("spec" , "list" , 1 , "value" ),
933
+ MakePathOrDie ("spec" , "list" , 2 ),
934
+ MakePathOrDie ("spec" , "list" , 2 , "value" ),
953
935
),
954
936
filter : NewIncludeMatcherFilter (
955
937
MakePrefixMatcherOrDie ("spec" , "list" , 0 , "value" ),
956
938
MakePrefixMatcherOrDie ("spec" , "list" , 1 , "value" ),
957
939
),
958
940
expect : NewSet (
959
941
MakePathOrDie ("spec" ),
942
+ MakePathOrDie ("spec" , "list" ),
943
+ MakePathOrDie ("spec" , "list" , 0 ),
960
944
MakePathOrDie ("spec" , "list" , 0 , "value" ),
945
+ MakePathOrDie ("spec" , "list" , 1 ),
961
946
MakePathOrDie ("spec" , "list" , 1 , "value" ),
962
947
),
963
948
},
964
949
{
965
950
name : "multiple field matchers" ,
966
951
input : NewSet (
952
+ MakePathOrDie ("spec" ),
953
+ MakePathOrDie ("spec" , "f1" ),
967
954
MakePathOrDie ("spec" , "f1" , "f11" ),
955
+ MakePathOrDie ("spec" , "f2" ),
968
956
MakePathOrDie ("spec" , "f2" , "f21" ),
957
+ MakePathOrDie ("spec" , "f3" ),
969
958
MakePathOrDie ("spec" , "f3" , "f31" ),
970
959
),
971
960
filter : NewIncludeMatcherFilter (
972
961
MakePrefixMatcherOrDie ("spec" , "f1" ),
973
962
MakePrefixMatcherOrDie ("spec" , "f3" ),
974
963
),
975
964
expect : NewSet (
965
+ MakePathOrDie ("spec" ),
966
+ MakePathOrDie ("spec" , "f1" ),
976
967
MakePathOrDie ("spec" , "f1" , "f11" ),
968
+ MakePathOrDie ("spec" , "f3" ),
977
969
MakePathOrDie ("spec" , "f3" , "f31" ),
978
970
),
979
971
},
980
972
{
981
973
name : "wildcard takes precedence" ,
982
974
input : NewSet (
975
+ MakePathOrDie ("spec" ),
976
+ MakePathOrDie ("spec" , "list" ),
977
+ MakePathOrDie ("spec" , "list" , 0 ),
983
978
MakePathOrDie ("spec" , "list" , 0 , "f1" ),
984
979
MakePathOrDie ("spec" , "list" , 0 , "f2" ),
980
+ MakePathOrDie ("spec" , "list" , 1 ),
985
981
MakePathOrDie ("spec" , "list" , 1 , "f1" ),
986
982
MakePathOrDie ("spec" , "list" , 1 , "f2" ),
983
+ MakePathOrDie ("spec" , "list" , 2 ),
987
984
MakePathOrDie ("spec" , "list" , 2 , "f1" ),
988
985
MakePathOrDie ("spec" , "list" , 2 , "f2" ),
989
986
),
@@ -992,8 +989,13 @@ func TestFilterByPattern(t *testing.T) {
992
989
MakePrefixMatcherOrDie ("spec" , "list" , 1 , "f2" ), // ignored
993
990
),
994
991
expect : NewSet (
992
+ MakePathOrDie ("spec" ),
993
+ MakePathOrDie ("spec" , "list" ),
994
+ MakePathOrDie ("spec" , "list" , 0 ),
995
995
MakePathOrDie ("spec" , "list" , 0 , "f1" ),
996
+ MakePathOrDie ("spec" , "list" , 1 ),
996
997
MakePathOrDie ("spec" , "list" , 1 , "f1" ),
998
+ MakePathOrDie ("spec" , "list" , 2 ),
997
999
MakePathOrDie ("spec" , "list" , 2 , "f1" ),
998
1000
),
999
1001
},
0 commit comments