Documentation
¶
Overview ¶
test/setup/bufconn_setup.go
Index ¶
Constants ¶
View Source
const BufSize = 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
func CreateTestClientConn ¶
func CreateTestClientConn(t *testing.T, unaryInterceptor grpc.UnaryClientInterceptor, streamInterceptor grpc.StreamClientInterceptor) *grpc.ClientConn
CreateTestClientConn creates a new client connection using bufconn.
func SetupTestDatabase ¶
SetupTestDatabase initializes the test database.
Types ¶
type ServerStruct ¶
type ServerStruct struct {
AuthServer *app.AuthServer
FriendsServer *app.FriendsServer
ChatServer *app.ChatServiceServer
}
func InitTestServer ¶
func InitTestServer(t *testing.T, serverConfig TestServerConfig) (*sql.DB, *ServerStruct)
InitTestServer initializes the in-memory gRPC server and the test database.
func InitializeTestResources ¶
func InitializeTestResources(t *testing.T, serverConfig *TestServerConfig, numClients int) ([]*app.RpcClient, *sql.DB, func(), *ServerStruct)
InitializeTestResources initializes the desired number of RpcClients for testing.
type TestFieldHook ¶
type TestFieldHook struct {
TestName string
}
TestFieldHook is a custom Logrus hook that adds a field to every log entry
func (*TestFieldHook) Fire ¶
func (hook *TestFieldHook) Fire(entry *logrus.Entry) error
Fire adds the test name field to every log entry
func (*TestFieldHook) Levels ¶
func (hook *TestFieldHook) Levels() []logrus.Level
Levels returns the log levels the hook should be applied to
type TestServerConfig ¶
type TestServerConfig struct {
DbName string
Log *logrus.Logger
AccessTokenDuration time.Duration
RefreshTokenDuration time.Duration
TimeProvider client.TimeProvider
}
func NewDefaultTestServerConfig ¶
func NewDefaultTestServerConfig(t *testing.T) (*TestServerConfig, error)
NewDefaultTestServerConfig creates a TestServerConfig with default values
Click to show internal directories.
Click to hide internal directories.