Documentation
¶
Overview ¶
Copyright (c) F5, Inc.
This source code is licensed under the Apache License, Version 2.0 license found in the LICENSE file in the root directory of this source tree.
Index ¶
- Variables
- func CreateDirWithErrorCheck(t testing.TB, dirName string)
- func CreateFileWithErrorCheck(t testing.TB, dir, fileName string) *os.File
- func CreateManifestDirWithErrorCheck(t testing.TB, dir, manifestFileName string) string
- func CreateNginxPlusStreamServer(t *testing.T) client.StreamUpstreamServer
- func CreateNginxPlusUpstreamServer(t *testing.T) client.UpstreamServer
- func CreateTestIDs(t testing.TB) (correlationID, instanceID uuid.UUID)
- func Env(tb testing.TB, envKey string) string
- func GenerateConfig(t testing.TB, outputFile string, targetSize int64) (fs.FileInfo, error)
- func GenerateSelfSignedCert(t testing.TB) (keyBytes, certBytes []byte)
- func GoVersion(t testing.TB, level int) (string, error)
- func LogAndTerminateContainers(ctx context.Context, tb testing.TB, ...)
- func NewMockNGINXPlusAPIServer(t *testing.T) *httptest.Server
- func RandomPort(t *testing.T, ctx context.Context) (int, error)
- func RemoveASCIIControlSignals(t testing.TB, input string) string
- func RemoveFileWithErrorCheck(t testing.TB, fileName string)
- func RequiredModuleVersion(t testing.TB, moduleName string, level int) (string, error)
- func StartAgentlessContainer(ctx context.Context, tb testing.TB, parameters *Parameters) testcontainers.Container
- func StartAuxiliaryMockManagementPlaneGrpcContainer(ctx context.Context, tb testing.TB, ...) testcontainers.Container
- func StartContainer(ctx context.Context, tb testing.TB, ...) testcontainers.Container
- func StartMockManagementPlaneGrpcContainer(ctx context.Context, tb testing.TB, ...) testcontainers.Container
- func StartNginxLessContainer(ctx context.Context, tb testing.TB, ...) testcontainers.Container
- func ToPtr[T any](value T) *T
- func ValidateLog(t *testing.T, expectedLog string, logBuf *bytes.Buffer)
- func WriteCertFiles(t *testing.T, location string, cert Cert) string
- type Cert
- type Parameters
Constants ¶
This section is empty.
Variables ¶
var GoLeakOptions = []goleak.Option{ goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), }
Functions ¶
func CreateDirWithErrorCheck ¶
func CreateNginxPlusStreamServer ¶
func CreateNginxPlusStreamServer(t *testing.T) client.StreamUpstreamServer
func CreateNginxPlusUpstreamServer ¶
func CreateNginxPlusUpstreamServer(t *testing.T) client.UpstreamServer
func GenerateConfig ¶
func GenerateSelfSignedCert ¶
func RandomPort ¶ added in v3.1.0
RandomPort generates a random port for testing and checks if a port is available by attempting to bind to it
func RemoveASCIIControlSignals ¶
RemoveASCIIControlSignals removes all non-printable ASCII control characters from a string.
func RequiredModuleVersion ¶
func StartAgentlessContainer ¶
func StartAgentlessContainer( ctx context.Context, tb testing.TB, parameters *Parameters, ) testcontainers.Container
func StartAuxiliaryMockManagementPlaneGrpcContainer ¶ added in v3.2.0
func StartContainer ¶
func StartContainer( ctx context.Context, tb testing.TB, containerNetwork *testcontainers.DockerNetwork, parameters *Parameters, ) testcontainers.Container
func StartNginxLessContainer ¶
func StartNginxLessContainer( ctx context.Context, tb testing.TB, containerNetwork *testcontainers.DockerNetwork, parameters *Parameters, ) testcontainers.Container
func ValidateLog ¶
ValidateLog checks if the expected log message is present in the provided log buffer. If the expected log message is not found, it reports an error to the testing framework.
Parameters:
- t (*testing.T): The testing object used to report errors.
- expectedLog (string): The expected log message to validate against the log buffer. If empty, no validation is performed.
- logBuf (*bytes.Buffer): The log buffer that contains the actual log messages.
Behavior: - If the expected log message is not an empty string:
- The function checks whether the log buffer contains the expected log message.
- If the log message is missing, an error is reported using t.Errorf.
Usage: - Use this function within test cases to validate that a specific log message was produced.
Example:
var logBuffer bytes.Buffer logBuffer.WriteString("App started successfully") ValidateLog(t, "App started successfully", &logBuffer)