File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1777,6 +1777,32 @@ func BenchmarkDistributor_Push(b *testing.B) {
17771777 },
17781778 expectedErr : "labels size bytes exceeded" ,
17791779 },
1780+ "timestamp too old" : {
1781+ prepareConfig : func (limits * validation.Limits ) {
1782+ limits .RejectOldSamples = true
1783+ limits .RejectOldSamplesMaxAge = model .Duration (time .Hour )
1784+ },
1785+ prepareSeries : func () ([]labels.Labels , []cortexpb.Sample ) {
1786+ metrics := make ([]labels.Labels , numSeriesPerRequest )
1787+ samples := make ([]cortexpb.Sample , numSeriesPerRequest )
1788+
1789+ for i := 0 ; i < numSeriesPerRequest ; i ++ {
1790+ lbls := labels .NewBuilder (labels.Labels {{Name : model .MetricNameLabel , Value : "foo" }})
1791+ for i := 0 ; i < 10 ; i ++ {
1792+ lbls .Set (fmt .Sprintf ("name_%d" , i ), fmt .Sprintf ("value_%d" , i ))
1793+ }
1794+
1795+ metrics [i ] = lbls .Labels (nil )
1796+ samples [i ] = cortexpb.Sample {
1797+ Value : float64 (i ),
1798+ TimestampMs : time .Now ().Add (- 2 * time .Hour ).UnixNano () / int64 (time .Millisecond ),
1799+ }
1800+ }
1801+
1802+ return metrics , samples
1803+ },
1804+ expectedErr : "timestamp too old" ,
1805+ },
17801806 "timestamp too new" : {
17811807 prepareConfig : func (limits * validation.Limits ) {
17821808 limits .CreationGracePeriod = model .Duration (time .Minute )
You can’t perform that action at this time.
0 commit comments