Keep the readiness fixture independent of sidecar test helpers
1 file changed,
+14
−1
internal/activator/activator_test.go+14 −1
CI failed — run details
diff --git a/internal/activator/activator_test.go b/internal/activator/activator_test.go| index 324c9a33f..4420ba8a1 100644 |
| --- a/internal/activator/activator_test.go |
| +++ b/internal/activator/activator_test.go |
| @@ -3242,6 +3242,19 @@ func TestWorkerSurvivingSettleWindowIsAwake(t *testing.T) { |
| } |
| } |
| +type workerReadyBackend struct { |
| + *fakeBackend |
| + acquired chan struct{} |
| + proceed <-chan struct{} |
| +} |
| + |
| +func (b *workerReadyBackend) Acquire(ctx context.Context, rt registry.Route) (Lease, error) { |
| + lease, err := b.fakeBackend.Acquire(ctx, rt) |
| + close(b.acquired) |
| + <-b.proceed |
| + return lease, err |
| +} |
| + |
| // …and a child that reports ready ends the window early: a fast sidecar must |
| // not pay ten seconds of dead time on every wake. |
| func TestWorkerReadyEndsSettleWindowEarly(t *testing.T) { |
| @@ -3254,7 +3267,7 @@ func TestWorkerReadyEndsSettleWindowEarly(t *testing.T) { |
| var release sync.Once |
| unblock := func() { release.Do(func() { close(proceed) }) } |
| defer unblock() |
| - a.backend = &ownerBackend{fakeBackend: b, acquired: acquired, proceed: proceed} |
| + a.backend = &workerReadyBackend{fakeBackend: b, acquired: acquired, proceed: proceed} |
| done := make(chan error, 1) |
| start := time.Now() |