test(broker): request local observation explicitly in fixtures
- commit
- 5a1c47bb37dc96e37dd279cf58cf3cceac1802dc
- author
- brice · · 2026-09-23 09:43 UTC
- parent
- 4827e8f
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +3 -1
M internal/app/broker_offline_local_test.go +3 -1
| @@ -791,6 +791,7 @@ func TestBrokerLocalObservationRegistryPublishesLocalFirst(t *testing.T) { | |||
| 791 | 791 | done := make(chan struct{}) | |
| 792 | 792 | go func() { defer close(done); registry.Run(ctx) }() | |
| 793 | 793 | t.Cleanup(func() { cancel(); <-done }) | |
| 794 | + | registry.RequestProbe("") | |
| 794 | 795 | ||
| 795 | 796 | require.Eventually(t, func() bool { | |
| 796 | 797 | snapshot := registry.Snapshot() | |
| @@ -932,10 +933,11 @@ func TestBrokerLocalProbeNilReceiverFailsClosed(t *testing.T) { | |||
| 932 | 933 | // startLocalRegistry runs one registry for the duration of a test. | |
| 933 | 934 | func startLocalRegistry(t *testing.T, registry *broker.Registry) { | |
| 934 | 935 | t.Helper() | |
| 936 | + | registry.SetDemand(true) | |
| 935 | 937 | ctx, cancel := context.WithCancel(context.Background()) | |
| 936 | 938 | done := make(chan struct{}) | |
| 937 | 939 | go func() { defer close(done); registry.Run(ctx) }() | |
| 938 | - | t.Cleanup(func() { cancel(); <-done }) | |
| 940 | + | t.Cleanup(func() { cancel(); <-done; registry.SetDemand(false) }) | |
| 939 | 941 | } | |
| 940 | 942 | ||
| 941 | 943 | // waitLocalEntry waits for the published local entry (always index zero) to | |
| @@ -791,6 +791,7 @@ func TestBrokerLocalObservationRegistryPublishesLocalFirst(t *testing.T) { | |||||
| 791 | done := make(chan struct{}) | 791 | done := make(chan struct{}) | ||
| 792 | go func() { defer close(done); registry.Run(ctx) }() | 792 | go func() { defer close(done); registry.Run(ctx) }() | ||
| 793 | t.Cleanup(func() { cancel(); <-done }) | 793 | t.Cleanup(func() { cancel(); <-done }) | ||
| 794 | + | registry.RequestProbe("") | |||
| 794 | 795 | ||||
| 795 | require.Eventually(t, func() bool { | 796 | require.Eventually(t, func() bool { | ||
| 796 | snapshot := registry.Snapshot() | 797 | snapshot := registry.Snapshot() | ||
| @@ -932,10 +933,11 @@ func TestBrokerLocalProbeNilReceiverFailsClosed(t *testing.T) { | |||||
| 932 | // startLocalRegistry runs one registry for the duration of a test. | 933 | // startLocalRegistry runs one registry for the duration of a test. | ||
| 933 | func startLocalRegistry(t *testing.T, registry *broker.Registry) { | 934 | func startLocalRegistry(t *testing.T, registry *broker.Registry) { | ||
| 934 | t.Helper() | 935 | t.Helper() | ||
| 936 | + | registry.SetDemand(true) | |||
| 935 | ctx, cancel := context.WithCancel(context.Background()) | 937 | ctx, cancel := context.WithCancel(context.Background()) | ||
| 936 | done := make(chan struct{}) | 938 | done := make(chan struct{}) | ||
| 937 | go func() { defer close(done); registry.Run(ctx) }() | 939 | go func() { defer close(done); registry.Run(ctx) }() | ||
| 938 | - | t.Cleanup(func() { cancel(); <-done }) | 940 | + | t.Cleanup(func() { cancel(); <-done; registry.SetDemand(false) }) |
| 939 | } | 941 | } | ||
| 940 | 942 | ||||
| 941 | // waitLocalEntry waits for the published local entry (always index zero) to | 943 | // waitLocalEntry waits for the published local entry (always index zero) to | ||