27 lines
408 B
Go
27 lines
408 B
Go
package grpcadapter
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"gl/application/health"
|
|
|
|
"google.golang.org/grpc/test/bufconn"
|
|
)
|
|
|
|
func TestRunStopsWhenContextIsCancelled(t *testing.T) {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
cancel()
|
|
|
|
err := runWithListener(
|
|
ctx,
|
|
time.Second,
|
|
bufconn.Listen(1024),
|
|
NewHealthHandler(health.NewService(nil)),
|
|
)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|