Files
evening_detective/internal/tests/client.go
T
2025-06-13 13:01:18 +07:00

24 lines
524 B
Go

package tests
import (
"context"
"log"
"time"
pb "evening_detective/proto"
"google.golang.org/grpc"
)
func getClient() (pb.EveningDetectiveClient, func() error) {
conn, err := grpc.Dial("localhost:8080", grpc.WithInsecure())
if err != nil {
log.Fatalf("Не удалось подключиться к серверу: %v", err)
}
return pb.NewEveningDetectiveClient(conn), conn.Close
}
func getContext() (context.Context, context.CancelFunc) {
return context.WithTimeout(context.Background(), time.Second)
}