@@ -29,6 +29,7 @@ import (
29
29
func TestIngester_v2Push (t * testing.T ) {
30
30
metricLabelAdapters := []client.LabelAdapter {{Name : labels .MetricName , Value : "test" }}
31
31
metricLabels := client .FromLabelAdaptersToLabels (metricLabelAdapters )
32
+ userID := "test"
32
33
33
34
tests := map [string ]struct {
34
35
reqs []* client.WriteRequest
@@ -71,7 +72,7 @@ func TestIngester_v2Push(t *testing.T) {
71
72
[]client.Sample {{Value : 1 , TimestampMs : 9 }},
72
73
client .API ),
73
74
},
74
- expectedErr : httpgrpc .Errorf (http .StatusBadRequest , tsdb .ErrOutOfOrderSample .Error ()),
75
+ expectedErr : httpgrpc .Errorf (http .StatusBadRequest , wrapWithUser ( tsdb .ErrOutOfOrderSample , userID ) .Error ()),
75
76
expectedIngested : []client.TimeSeries {
76
77
{Labels : metricLabelAdapters , Samples : []client.Sample {{Value : 2 , TimestampMs : 10 }}},
77
78
},
@@ -95,7 +96,7 @@ func TestIngester_v2Push(t *testing.T) {
95
96
[]client.Sample {{Value : 1 , TimestampMs : 1575043969 - (86400 * 1000 )}},
96
97
client .API ),
97
98
},
98
- expectedErr : httpgrpc .Errorf (http .StatusBadRequest , tsdb .ErrOutOfBounds .Error ()),
99
+ expectedErr : httpgrpc .Errorf (http .StatusBadRequest , wrapWithUser ( tsdb .ErrOutOfBounds , userID ) .Error ()),
99
100
expectedIngested : []client.TimeSeries {
100
101
{Labels : metricLabelAdapters , Samples : []client.Sample {{Value : 2 , TimestampMs : 1575043969 }}},
101
102
},
@@ -119,7 +120,7 @@ func TestIngester_v2Push(t *testing.T) {
119
120
[]client.Sample {{Value : 1 , TimestampMs : 1575043969 }},
120
121
client .API ),
121
122
},
122
- expectedErr : httpgrpc .Errorf (http .StatusBadRequest , tsdb .ErrAmendSample .Error ()),
123
+ expectedErr : httpgrpc .Errorf (http .StatusBadRequest , wrapWithUser ( tsdb .ErrAmendSample , userID ) .Error ()),
123
124
expectedIngested : []client.TimeSeries {
124
125
{Labels : metricLabelAdapters , Samples : []client.Sample {{Value : 2 , TimestampMs : 1575043969 }}},
125
126
},
@@ -147,7 +148,7 @@ func TestIngester_v2Push(t *testing.T) {
147
148
defer i .Shutdown ()
148
149
defer cleanup ()
149
150
150
- ctx := user .InjectOrgID (context .Background (), "test" )
151
+ ctx := user .InjectOrgID (context .Background (), userID )
151
152
152
153
// Wait until the ingester is ACTIVE
153
154
test .Poll (t , 100 * time .Millisecond , ring .ACTIVE , func () interface {} {
@@ -470,7 +471,7 @@ func TestIngester_v2Push_ShouldNotCreateTSDBIfNotInActiveState(t *testing.T) {
470
471
req := & client.WriteRequest {}
471
472
472
473
res , err := i .v2Push (ctx , req )
473
- assert .Equal (t , fmt .Errorf (errTSDBCreateIncompatibleState , "PENDING" ), err )
474
+ assert .Equal (t , wrapWithUser ( fmt .Errorf (errTSDBCreateIncompatibleState , "PENDING" ), userID ). Error (), err . Error () )
474
475
assert .Nil (t , res )
475
476
476
477
// Check if the TSDB has been created
0 commit comments