Skip to content

Commit e03de58

Browse files
committed
Fix tests
1 parent 62f6bf2 commit e03de58

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

driver/sql/postgres/projector_aggregate_bench_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ func setup(
181181
return driverSQL.ProjectionFail
182182
},
183183
goengine.NopLogger,
184+
goengine.NopMetrics,
184185
)
185186
require.NoError(b, err, "failed to create aggregate projector")
186187

extension/prometheus/prometheus.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package prometheus
22

33
import (
44
"fmt"
5-
"github.com/hellofresh/goengine/driver/sql"
65
"github.com/prometheus/client_golang/prometheus"
76
"strconv"
87
"time"
@@ -74,19 +73,19 @@ func (m *Metrics) ReceivedNotification(isNotification bool) {
7473
}
7574

7675
// QueueNotification returns http handler for prometheus
77-
func (m *Metrics) QueueNotification(notification *sql.ProjectionNotification) {
76+
func (m *Metrics) QueueNotification(notification interface{}) {
7877
key := "q" + fmt.Sprintf("%p", notification)
7978
m.notificationStartTimes[key] = time.Now()
8079
}
8180

8281
// StartNotificationProcessing is used to record start time of notification processing
83-
func (m *Metrics) StartNotificationProcessing(notification *sql.ProjectionNotification) {
82+
func (m *Metrics) StartNotificationProcessing(notification interface{}) {
8483
key := "p" + fmt.Sprintf("%p", notification)
8584
m.notificationStartTimes[key] = time.Now()
8685
}
8786

8887
// FinishNotificationProcessing is used to observe end time of notification queue and processing time
89-
func (m *Metrics) FinishNotificationProcessing(notification *sql.ProjectionNotification, success bool, retry bool) {
88+
func (m *Metrics) FinishNotificationProcessing(notification interface{}, success bool, retry bool) {
9089
memAddress := fmt.Sprintf("%p", notification)
9190
queueStartTime := m.notificationStartTimes["q"+memAddress]
9291
processingStartTime := m.notificationStartTimes["p"+memAddress]

test/internal/suite.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package internal
22

33
import (
4+
"github.com/hellofresh/goengine/extension/prometheus"
45
"testing"
56

67
"github.com/hellofresh/goengine"
@@ -16,6 +17,8 @@ type Suite struct {
1617

1718
Logger *logrus.Logger
1819
LoggerHook *test.Hook
20+
21+
Metrics *prometheus.Metrics
1922
}
2023

2124
// SetupTest set logrus output to use the current testing.T
@@ -25,6 +28,8 @@ func (s *Suite) SetupTest() {
2528
s.Logger.SetOutput(NewLogWriter(s.T()))
2629

2730
s.LoggerHook = test.NewLocal(s.Logger)
31+
32+
s.Metrics = prometheus.NewMetrics()
2833
}
2934

3035
// TearDownTest cleanup suite variables

test/projector_aggregate_integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ func (s *aggregateProjectorTestSuite) TestRun() {
260260
return driverSQL.ProjectionFail
261261
},
262262
s.GetLogger(),
263+
s.Metrics,
263264
)
264265
s.Require().NoError(err, "failed to create projector")
265266

0 commit comments

Comments
 (0)