Documentation
¶
Index ¶
- Constants
- Variables
- func GenPtr[T any](v T) *T
- func NewContextWithObservableLogger(ctx context.Context) (context.Context, *observer.ObservedLogs)
- func ProxyTestCommonSetup(t *testing.T, proxy *TestProxyServer) (grpc_proxy_v1.ProxyServiceClient, func())
- func Run(t *testing.T, s suite.TestingSuite)
- func ValidateLogOutput(t *testing.T, observedLogs *observer.ObservedLogs, ...)
- type CommonSuite
- type TestProxyServer
Constants ¶
View Source
const ( LDAPPort = "389" LDAPSPort = "636" )
Variables ¶
View Source
var (
TestConnectorInfo = connector.ConnectorInfo{
ID: "test-connector-id",
ClientID: "test-client-id",
TenantID: "test-tenant-id",
}
)
Functions ¶
func NewContextWithObservableLogger ¶ added in v1.58.0
NewContextWithObservableLogger creates a new context enriched with an observable logger which can be used in tests to capture and inspect log output.
func ProxyTestCommonSetup ¶ added in v1.39.0
func ProxyTestCommonSetup(t *testing.T, proxy *TestProxyServer) (grpc_proxy_v1.ProxyServiceClient, func())
func ValidateLogOutput ¶ added in v1.58.0
func ValidateLogOutput(t *testing.T, observedLogs *observer.ObservedLogs, expectedLogs []map[string]any)
ValidateLogOutput compares the observed logs against the expected logs. No comparison happens if expectedLogs is nil or empty. The observed logs are extracted from the provided observer.ObservedLogs and additional fields like "msg" and "level" are added for comparison. If the comparison fails, an error is reported using the testing.T instance.
Types ¶
type CommonSuite ¶
func (*CommonSuite) StartLDAPServer ¶
func (s *CommonSuite) StartLDAPServer(ctx context.Context, isLDAPS bool) (testcontainers.Container, nat.Port)
StartLDAPServer runs an instance of active directory over LDAP protocol in a local container for testing. It returns the container and open port. May fail the test internally if setup fails.
type TestProxyServer ¶ added in v1.39.0
type TestProxyServer struct {
GrpcErr error
ResponseErrStr *string
Response *string
Ci *connector.ConnectorInfo
IsLDAPResponse bool
IsSQLResponse bool
grpc_proxy_v1.UnimplementedProxyServiceServer
}
func (*TestProxyServer) ProxyRequest ¶ added in v1.39.0
func (s *TestProxyServer) ProxyRequest(_ context.Context, req *grpc_proxy_v1.ProxyRequestMessage, ) (*grpc_proxy_v1.Response, error)
Click to show internal directories.
Click to hide internal directories.