testutil

package
v1.58.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2025 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Copyright 2025 SGNL.ai, Inc.

Copyright 2025 SGNL.ai, Inc.

Copyright 2025 SGNL.ai, Inc.

Copyright 2025 SGNL.ai, Inc.

Index

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 GenPtr

func GenPtr[T any](v T) *T

func NewContextWithObservableLogger added in v1.58.0

func NewContextWithObservableLogger(ctx context.Context) (context.Context, *observer.ObservedLogs)

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 Run

func Run(t *testing.T, s suite.TestingSuite)

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

type CommonSuite struct {
	suite.Suite
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL