test

package
v1.1.0-rc-1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package test contains higher-level (e.g., integration) tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogCapture

type LogCapture struct {
	Lines []string
	// contains filtered or unexported fields
}

func NewLogCapture

func NewLogCapture(logger *logrus.Logger) *LogCapture

NewLogCapture sets up plain text logging to be captured for testing purposes

func NewLogCaptureWithCurrentFormatter

func NewLogCaptureWithCurrentFormatter(logger *logrus.Logger) *LogCapture

NewLogCaptureWithCurrentFormatter sets up capture with current formatter

func (*LogCapture) Clear

func (l *LogCapture) Clear()

Clear clears captured lines

func (*LogCapture) Extract

func (l *LogCapture) Extract(index int, key string) string

Extract looks for a key=value pair for line at given index, returning the value or empty if not found. This is possible because we log using plain text logging.

func (*LogCapture) Len

func (l *LogCapture) Len() int

Len returns number of log lines captured

func (*LogCapture) Write

func (l *LogCapture) Write(p []byte) (n int, err error)

Write echos line to console and captures same line

type MockRoundTripper

type MockRoundTripper struct {
	Responses map[string][]*http.Response
	Errors    map[string][]error
}

func NewHTTPMock

func NewHTTPMock() *MockRoundTripper

func (*MockRoundTripper) Expect

func (m *MockRoundTripper) Expect(method string, body string, status int, err error)

func (*MockRoundTripper) HTTPClient

func (m *MockRoundTripper) HTTPClient() *http.Client

func (*MockRoundTripper) RoundTrip

func (m *MockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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