@@ -61,36 +61,53 @@ func testPrometheusStoreSeriesE2e(t *testing.T, prefix string) {
6161 }, nil )
6262 testutil .Ok (t , err )
6363
64- // Query all three samples except for the first one. Since we round up queried data
65- // to seconds, we can test whether the extra sample gets stripped properly.
66- srv := newStoreSeriesServer (ctx )
64+ {
65+ // Query all three samples except for the first one. Since we round up queried data
66+ // to seconds, we can test whether the extra sample gets stripped properly.
67+ srv := newStoreSeriesServer (ctx )
68+
69+ err = proxy .Series (& storepb.SeriesRequest {
70+ MinTime : baseT + 101 ,
71+ MaxTime : baseT + 300 ,
72+ Matchers : []storepb.LabelMatcher {
73+ {Type : storepb .LabelMatcher_EQ , Name : "a" , Value : "b" },
74+ },
75+ }, srv )
76+ testutil .Ok (t , err )
6777
68- err = proxy .Series (& storepb.SeriesRequest {
69- MinTime : baseT + 101 ,
70- MaxTime : baseT + 300 ,
71- Matchers : []storepb.LabelMatcher {
72- {Type : storepb .LabelMatcher_EQ , Name : "a" , Value : "b" },
73- },
74- }, srv )
75- testutil .Ok (t , err )
78+ testutil .Equals (t , 1 , len (srv .SeriesSet ))
7679
77- testutil .Equals (t , 1 , len (srv .SeriesSet ))
80+ testutil .Equals (t , []storepb.Label {
81+ {Name : "a" , Value : "b" },
82+ {Name : "region" , Value : "eu-west" },
83+ }, srv .SeriesSet [0 ].Labels )
7884
79- testutil .Equals (t , []storepb.Label {
80- {Name : "a" , Value : "b" },
81- {Name : "region" , Value : "eu-west" },
82- }, srv .SeriesSet [0 ].Labels )
85+ testutil .Equals (t , 1 , len (srv .SeriesSet [0 ].Chunks ))
8386
84- testutil .Equals (t , 1 , len (srv .SeriesSet [0 ].Chunks ))
87+ c := srv .SeriesSet [0 ].Chunks [0 ]
88+ testutil .Equals (t , storepb .Chunk_XOR , c .Raw .Type )
8589
86- c := srv . SeriesSet [ 0 ]. Chunks [ 0 ]
87- testutil .Equals (t , storepb . Chunk_XOR , c . Raw . Type )
90+ chk , err := chunkenc . FromData ( chunkenc . EncXOR , c . Raw . Data )
91+ testutil .Ok (t , err )
8892
89- chk , err := chunkenc . FromData ( chunkenc . EncXOR , c . Raw . Data )
90- testutil .Ok (t , err )
93+ samples := expandChunk ( chk . Iterator () )
94+ testutil .Equals (t , [] sample {{ baseT + 200 , 2 }, { baseT + 300 , 3 }}, samples )
9195
92- samples := expandChunk (chk .Iterator ())
93- testutil .Equals (t , []sample {{baseT + 200 , 2 }, {baseT + 300 , 3 }}, samples )
96+ }
97+ // Querying by external labels only.
98+ {
99+ srv := newStoreSeriesServer (ctx )
100+
101+ err = proxy .Series (& storepb.SeriesRequest {
102+ MinTime : baseT + 101 ,
103+ MaxTime : baseT + 300 ,
104+ Matchers : []storepb.LabelMatcher {
105+ {Type : storepb .LabelMatcher_EQ , Name : "region" , Value : "eu-west" },
106+ },
107+ }, srv )
108+ testutil .NotOk (t , err )
109+ testutil .Equals (t , "rpc error: code = InvalidArgument desc = no matchers specified (excluding external labels)" , err .Error ())
110+ }
94111}
95112
96113type sample struct {
0 commit comments