File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ // +build unit
2+
3+ package prometheus
4+
5+ import (
6+ "fmt"
7+ "testing"
8+ "time"
9+
10+ "github.com/stretchr/testify/assert"
11+
12+ "github.com/hellofresh/goengine/driver/sql"
13+ )
14+
15+ func TestPrometheusMetrics (t * testing.T ) {
16+ metrics := NewMetrics ()
17+
18+ testSQLProjection := sql.ProjectionNotification {
19+ No : 1 ,
20+ AggregateID : "C56A4180-65AA-42EC-A945-5FD21DEC0538" ,
21+ }
22+
23+ metrics .QueueNotification (& testSQLProjection )
24+ metrics .StartNotificationProcessing (& testSQLProjection )
25+
26+ memAddress := fmt .Sprintf ("%p" , & testSQLProjection )
27+ queueStartTime , ok := metrics .notificationStartTimes .Load ("q" + memAddress )
28+ assert .True (t , ok )
29+ assert .IsType (t , time.Time {}, queueStartTime )
30+
31+ processingStartTime , _ := metrics .notificationStartTimes .Load ("p" + memAddress )
32+ assert .True (t , ok )
33+ assert .IsType (t , time.Time {}, processingStartTime )
34+ }
You can’t perform that action at this time.
0 commit comments