Documentation
¶
Index ¶
- func AssertError(t *testing.T, err error, message string)
- func AssertErrorContains(t *testing.T, err error, expectedText string)
- func AssertJSONContainsFields(t *testing.T, data []byte, expectedFields []string)
- func AssertJSONValid(t *testing.T, data []byte)
- func AssertLatencyInRange(t *testing.T, actual, expected, tolerance time.Duration)
- func AssertNoError(t *testing.T, err error, message string)
- func AssertPortClosed(t *testing.T, host string, port int, isOpen bool, message string)
- func AssertPortOpen(t *testing.T, host string, port int, isOpen bool, message string)
- func CreateDataStream(size int) []byte
- func CreateMockDialer(conn net.Conn, err error) func(network, address string) (net.Conn, error)
- func CreateMockListener(t *testing.T, port int) net.Listener
- func CreateTestContext(timeout time.Duration) (context.Context, context.CancelFunc)
- func GetFIPSConfig() *config.Config
- func GetFreePort(t *testing.T) int
- func GetInvalidFIPSConfig() *config.Config
- func GetMinimalConfig() *config.Config
- func GetNonFIPSConfig() *config.Config
- func MustMarshalJSON(t *testing.T, v interface{}) []byte
- func MustUnmarshalJSON(t *testing.T, data []byte, v interface{})
- func SetupSlowTestServer(t *testing.T, delay time.Duration) (string, func())
- func SetupTestServer(t *testing.T, handler http.HandlerFunc) (string, func())
- func SetupTestServerWithResponse(t *testing.T, statusCode int, body string) (string, func())
- func SetupTestTCPServer(t *testing.T) (string, func())
- func WaitForCondition(t *testing.T, condition func() bool, timeout time.Duration, message string)
- func WaitForPort(t *testing.T, host string, port int, timeout time.Duration) bool
- type ConfigFixture
- type MockAddr
- type MockConn
- func (m *MockConn) Close() error
- func (m *MockConn) LocalAddr() net.Addr
- func (m *MockConn) Read(b []byte) (n int, err error)
- func (m *MockConn) RemoteAddr() net.Addr
- func (m *MockConn) SetDeadline(t time.Time) error
- func (m *MockConn) SetReadDeadline(t time.Time) error
- func (m *MockConn) SetWriteDeadline(t time.Time) error
- func (m *MockConn) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertError ¶
AssertError is a helper that fails the test if error is nil
func AssertErrorContains ¶
AssertErrorContains validates that error message contains expected text
func AssertJSONContainsFields ¶
AssertJSONContainsFields validates that JSON contains expected fields
func AssertJSONValid ¶
AssertJSONValid validates that data is valid JSON
func AssertLatencyInRange ¶
AssertLatencyInRange validates that latency is within expected range
func AssertNoError ¶
AssertNoError is a helper that fails the test if error is not nil
func AssertPortClosed ¶
AssertPortClosed validates that a port is reported as closed
func AssertPortOpen ¶
AssertPortOpen validates that a port is reported as open
func CreateDataStream ¶
CreateDataStream creates a mock data stream of specified size
func CreateMockDialer ¶
CreateMockDialer creates a mock dialer that returns a mock connection
func CreateMockListener ¶
CreateMockListener creates a mock listener for testing
func CreateTestContext ¶
CreateTestContext creates a context with timeout for testing
func GetFIPSConfig ¶
GetFIPSConfig returns a valid FIPS-compliant configuration
func GetFreePort ¶
GetFreePort returns an available port on localhost
func GetInvalidFIPSConfig ¶
GetInvalidFIPSConfig returns a configuration that claims FIPS but uses non-compliant settings
func GetMinimalConfig ¶
GetMinimalConfig returns a minimal valid configuration
func GetNonFIPSConfig ¶
GetNonFIPSConfig returns a valid non-FIPS configuration
func MustMarshalJSON ¶
MustMarshalJSON marshals data to JSON or fails the test
func MustUnmarshalJSON ¶
MustUnmarshalJSON unmarshals JSON data or fails the test
func SetupSlowTestServer ¶
SetupSlowTestServer creates an HTTP test server with artificial delay
func SetupTestServer ¶
func SetupTestServer(t *testing.T, handler http.HandlerFunc) (string, func())
SetupTestServer creates an HTTP test server with the given handler
func SetupTestServerWithResponse ¶
SetupTestServerWithResponse creates an HTTP test server that returns specific response
func SetupTestTCPServer ¶
SetupTestTCPServer creates a TCP test server that echoes data
func WaitForCondition ¶
WaitForCondition waits for a condition to be true or timeout
Types ¶
type ConfigFixture ¶
ConfigFixture represents a test configuration scenario
func GetConfigFixtures ¶
func GetConfigFixtures() []ConfigFixture
GetConfigFixtures returns a collection of test configuration scenarios
type MockConn ¶
type MockConn struct {
ReadFunc func(b []byte) (n int, err error)
WriteFunc func(b []byte) (n int, err error)
CloseFunc func() error
LocalAddrFunc func() net.Addr
RemoteAddrFunc func() net.Addr
SetDeadlineFunc func(t time.Time) error
SetReadDeadlineFunc func(t time.Time) error
SetWriteDeadlineFunc func(t time.Time) error
}
MockConn implements net.Conn for testing without real network access
func MockConnWithData ¶
MockConnWithData creates a mock connection that returns specific data
func MockConnWithError ¶
MockConnWithError creates a mock connection that returns an error
func MockConnWithLatency ¶
MockConnWithLatency creates a mock connection with artificial latency