fix(GODT-2774): Add external context to telemetry tasks

This ensures they get cancelled if the parent context becomes invalid
This commit is contained in:
Leander Beernaert
2023-07-06 12:00:19 +02:00
parent 1c2cb4f439
commit 40c48ba804
18 changed files with 67 additions and 58 deletions

View File

@ -314,7 +314,7 @@ func (s *scenario) bridgeTelemetryFeatureDisabled() error {
}
func (s *scenario) checkTelemetry(expect bool) error {
res := s.t.bridge.IsTelemetryAvailable()
res := s.t.bridge.IsTelemetryAvailable(context.Background())
if res != expect {
return fmt.Errorf("expected telemetry feature %v but got %v ", expect, res)
}

View File

@ -18,6 +18,7 @@
package tests
import (
"context"
"errors"
"testing"
"time"
@ -54,14 +55,14 @@ func (hb *heartbeatRecorder) GetLastHeartbeatSent() time.Time {
return hb.bridge.GetLastHeartbeatSent()
}
func (hb *heartbeatRecorder) IsTelemetryAvailable() bool {
func (hb *heartbeatRecorder) IsTelemetryAvailable(ctx context.Context) bool {
if hb.bridge == nil {
return false
}
return hb.bridge.IsTelemetryAvailable()
return hb.bridge.IsTelemetryAvailable(ctx)
}
func (hb *heartbeatRecorder) SendHeartbeat(metrics *telemetry.HeartbeatData) bool {
func (hb *heartbeatRecorder) SendHeartbeat(_ context.Context, metrics *telemetry.HeartbeatData) bool {
if hb.bridge == nil {
return false
}