shutdown broker once done
This commit is contained in:
parent
2a2ad553a1
commit
023245a7ba
@ -13,9 +13,13 @@ func TestFunction(t *testing.T) {
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
|
// cancellation context
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
// create service
|
// create service
|
||||||
fn := NewFunction(
|
fn := NewFunction(
|
||||||
Name("test.function"),
|
Name("test.function"),
|
||||||
|
Context(ctx),
|
||||||
Registry(mock.NewRegistry()),
|
Registry(mock.NewRegistry()),
|
||||||
AfterStart(func() error {
|
AfterStart(func() error {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
@ -47,6 +51,8 @@ func TestFunction(t *testing.T) {
|
|||||||
if rsp.Status != "ok" {
|
if rsp.Status != "ok" {
|
||||||
t.Fatalf("function response: %s", rsp.Status)
|
t.Fatalf("function response: %s", rsp.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancel()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// run service
|
// run service
|
||||||
|
Loading…
Reference in New Issue
Block a user