From e9fbbe3373eb66a345f5e3829e2563b94dc92051 Mon Sep 17 00:00:00 2001 From: Gab Virebent Date: Mon, 24 Aug 2026 17:34:45 +0200 Subject: Harden transport and preserve profile identities --- internal/transporthealth/monitor_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 internal/transporthealth/monitor_test.go (limited to 'internal/transporthealth/monitor_test.go') diff --git a/internal/transporthealth/monitor_test.go b/internal/transporthealth/monitor_test.go new file mode 100644 index 0000000..c5eb98d --- /dev/null +++ b/internal/transporthealth/monitor_test.go @@ -0,0 +1,30 @@ +package transporthealth + +import ( + "context" + "errors" + "testing" + "time" +) + +type checkerFunc func(context.Context) error + +func (f checkerFunc) Check(ctx context.Context) error { + return f(ctx) +} + +func TestProbeTracksReadiness(t *testing.T) { + var checkErr error + monitor := New(checkerFunc(func(context.Context) error { return checkErr }), time.Minute, time.Second) + + monitor.Probe(context.Background()) + if !monitor.Ready() { + t.Fatal("successful probe did not mark transport ready") + } + + checkErr = errors.New("transport unavailable") + monitor.Probe(context.Background()) + if monitor.Ready() { + t.Fatal("failed probe left transport ready") + } +} -- cgit v1.2.3