Files
mesh-contracts/provisioning/go/clients/meshprovisionerclient/provider/harness/early_test.go
T

23 lines
587 B
Go

package harness
// The moved path started before its runtime answers asks again until it does (issue 943).
import (
"context"
"errors"
)
// earlyBus refuses its first watches as the runtime does before Serve runs, then answers as the bucket bus does.
type earlyBus struct {
*bucketBus
refuse int
}
func (b *earlyBus) Watch(ctx context.Context, bucket string, handle func(string, []byte)) error {
if b.refuse > 0 {
b.refuse--
return errors.New("before Serve: a bundle reaches the bus through the runtime that launched it")
}
return b.bucketBus.Watch(ctx, bucket, handle)
}