@@ -74,8 +74,6 @@ func TestStoreCreateOrUpdate(t *testing.T) {
7474 if got .Status != taskqueue .JobStatusCompleted {
7575 t .Errorf ("job status does not match the expected one. Diff:\n %s" , cmp .Diff (job , got ))
7676 }
77-
78- t .Log ("Job updated" , got .UpdatedAt )
7977}
8078
8179func TestStoreLastHeartbeats (t * testing.T ) {
@@ -132,51 +130,54 @@ func TestMetricsBackend(t *testing.T) {
132130 mb := NewMetricsBackend (client , WithNamespace ("test" ))
133131 now := time .Now ()
134132
133+ gaugeKey := redisZSetKeyGaugeMetrics ("test" , taskqueue .MetricPendingQueueSize , map [string ]string {"name" : "test_redis_queue" })
134+ client .Del (context .Background (), gaugeKey )
135+
135136 if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
136137 Name : taskqueue .MetricPendingQueueSize ,
137- Labels : map [string ]string {"name" : "email_queue " },
138+ Labels : map [string ]string {"name" : "test_redis_queue " },
138139 }, 45 , now .Add (- time .Minute * 120 )); err != nil {
139140 t .Fatal (err )
140141 }
141142
142143 if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
143144 Name : taskqueue .MetricPendingQueueSize ,
144- Labels : map [string ]string {"name" : "email_queue " },
145+ Labels : map [string ]string {"name" : "test_redis_queue " },
145146 }, 60 , now .Add (- time .Minute * 60 )); err != nil {
146147 t .Fatal (err )
147148 }
148149
149150 if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
150151 Name : taskqueue .MetricPendingQueueSize ,
151- Labels : map [string ]string {"name" : "email_queue " },
152+ Labels : map [string ]string {"name" : "test_redis_queue " },
152153 }, 45 , now .Add (- time .Minute * 45 )); err != nil {
153154 t .Fatal (err )
154155 }
155156
156157 if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
157158 Name : taskqueue .MetricPendingQueueSize ,
158- Labels : map [string ]string {"name" : "email_queue " },
159+ Labels : map [string ]string {"name" : "test_redis_queue " },
159160 }, 32 , now .Add (- time .Minute * 30 )); err != nil {
160161 t .Fatal (err )
161162 }
162163
163164 if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
164165 Name : taskqueue .MetricPendingQueueSize ,
165- Labels : map [string ]string {"name" : "email_queue " },
166+ Labels : map [string ]string {"name" : "test_redis_queue " },
166167 }, 2 , now .Add (- time .Minute * 15 )); err != nil {
167168 t .Fatal (err )
168169 }
169170
170171 if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
171172 Name : taskqueue .MetricPendingQueueSize ,
172- Labels : map [string ]string {"name" : "email_queue " },
173+ Labels : map [string ]string {"name" : "test_redis_queue " },
173174 }, 80 , now ); err != nil {
174175 t .Fatal (err )
175176 }
176177
177178 gv , err := mb .QueryRangeGaugeValues (context .Background (), taskqueue.Metric {
178179 Name : taskqueue .MetricPendingQueueSize ,
179- Labels : map [string ]string {"name" : "email_queue " },
180+ Labels : map [string ]string {"name" : "test_redis_queue " },
180181 }, now .Add (- time .Minute * 120 ), now )
181182 if err != nil {
182183 t .Fatal (err )
0 commit comments