@@ -74,8 +74,6 @@ func TestStoreCreateOrUpdate(t *testing.T) {
74
74
if got .Status != taskqueue .JobStatusCompleted {
75
75
t .Errorf ("job status does not match the expected one. Diff:\n %s" , cmp .Diff (job , got ))
76
76
}
77
-
78
- t .Log ("Job updated" , got .UpdatedAt )
79
77
}
80
78
81
79
func TestStoreLastHeartbeats (t * testing.T ) {
@@ -132,51 +130,54 @@ func TestMetricsBackend(t *testing.T) {
132
130
mb := NewMetricsBackend (client , WithNamespace ("test" ))
133
131
now := time .Now ()
134
132
133
+ gaugeKey := redisZSetKeyGaugeMetrics ("test" , taskqueue .MetricPendingQueueSize , map [string ]string {"name" : "test_redis_queue" })
134
+ client .Del (context .Background (), gaugeKey )
135
+
135
136
if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
136
137
Name : taskqueue .MetricPendingQueueSize ,
137
- Labels : map [string ]string {"name" : "email_queue " },
138
+ Labels : map [string ]string {"name" : "test_redis_queue " },
138
139
}, 45 , now .Add (- time .Minute * 120 )); err != nil {
139
140
t .Fatal (err )
140
141
}
141
142
142
143
if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
143
144
Name : taskqueue .MetricPendingQueueSize ,
144
- Labels : map [string ]string {"name" : "email_queue " },
145
+ Labels : map [string ]string {"name" : "test_redis_queue " },
145
146
}, 60 , now .Add (- time .Minute * 60 )); err != nil {
146
147
t .Fatal (err )
147
148
}
148
149
149
150
if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
150
151
Name : taskqueue .MetricPendingQueueSize ,
151
- Labels : map [string ]string {"name" : "email_queue " },
152
+ Labels : map [string ]string {"name" : "test_redis_queue " },
152
153
}, 45 , now .Add (- time .Minute * 45 )); err != nil {
153
154
t .Fatal (err )
154
155
}
155
156
156
157
if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
157
158
Name : taskqueue .MetricPendingQueueSize ,
158
- Labels : map [string ]string {"name" : "email_queue " },
159
+ Labels : map [string ]string {"name" : "test_redis_queue " },
159
160
}, 32 , now .Add (- time .Minute * 30 )); err != nil {
160
161
t .Fatal (err )
161
162
}
162
163
163
164
if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
164
165
Name : taskqueue .MetricPendingQueueSize ,
165
- Labels : map [string ]string {"name" : "email_queue " },
166
+ Labels : map [string ]string {"name" : "test_redis_queue " },
166
167
}, 2 , now .Add (- time .Minute * 15 )); err != nil {
167
168
t .Fatal (err )
168
169
}
169
170
170
171
if err := mb .RecordGauge (context .Background (), taskqueue.Metric {
171
172
Name : taskqueue .MetricPendingQueueSize ,
172
- Labels : map [string ]string {"name" : "email_queue " },
173
+ Labels : map [string ]string {"name" : "test_redis_queue " },
173
174
}, 80 , now ); err != nil {
174
175
t .Fatal (err )
175
176
}
176
177
177
178
gv , err := mb .QueryRangeGaugeValues (context .Background (), taskqueue.Metric {
178
179
Name : taskqueue .MetricPendingQueueSize ,
179
- Labels : map [string ]string {"name" : "email_queue " },
180
+ Labels : map [string ]string {"name" : "test_redis_queue " },
180
181
}, now .Add (- time .Minute * 120 ), now )
181
182
if err != nil {
182
183
t .Fatal (err )
0 commit comments