testutil

package
v0.0.0-...-38f41cd Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPBinHostname = "myhttpbin"
	MySQLHostname   = "mydb"
	SSHdHostname    = "mysshd"
)
View Source
const MultipartBoundary = "123456789012345678901234567890abcdefghijklmnopqrstuvwxyz"

Variables

View Source
var Cacert = func() []byte {
	b, err := os.ReadFile(filepath.Join(Testdata(), "cacert.pem"))
	if err != nil {
		panic(err)
	}
	return b
}()
View Source
var Cert = func() []byte {
	b, err := os.ReadFile(filepath.Join(Testdata(), "cert.pem"))
	if err != nil {
		panic(err)
	}
	return b
}()
View Source
var Key = func() []byte {
	b, err := os.ReadFile(filepath.Join(Testdata(), "key.pem"))
	if err != nil {
		panic(err)
	}
	return b
}()

Functions

func BenchmarkSet

func BenchmarkSet(t testing.TB, bookCount, stepCount int, body string) (*httptest.Server, string)

BenchmarkSet returns a server and a path pattern for benchmarking.

func CreateHTTPBinContainer

func CreateHTTPBinContainer(t *testing.T) string

func CreateMySQLContainer

func CreateMySQLContainer(t *testing.T) (*sql.DB, string)

func CreateSSHdContainer

func CreateSSHdContainer(t *testing.T) (*ssh.Client, string, string, string, int)

func GRPCServer

func GRPCServer(t *testing.T, useTLS bool, disableReflection bool) *grpcstub.Server

func HTTPSServer

func HTTPSServer(t testing.TB) *httptest.Server

func HTTPSServerAndRouter

func HTTPSServerAndRouter(t testing.TB) (*httptest.Server, *httpstub.Router)

func HTTPServer

func HTTPServer(t testing.TB) *httptest.Server

func HTTPServerAndRouter

func HTTPServerAndRouter(t testing.TB) (*httptest.Server, *httpstub.Router)

func NewNullSSHClient

func NewNullSSHClient() *ssh.Client

func NewPort

func NewPort(t testing.TB) int

func Root

func Root() string

func SQLite

func SQLite(t *testing.T) (*sql.DB, string)

func SSHServer

func SSHServer(t testing.TB) string

func SkipCDPTest

func SkipCDPTest(t *testing.T) bool

func Testdata

func Testdata() string

Types

type NullChannel

type NullChannel struct{}

func (*NullChannel) Close

func (*NullChannel) Close() error

func (*NullChannel) CloseWrite

func (*NullChannel) CloseWrite() error

func (*NullChannel) Read

func (*NullChannel) Read(data []byte) (int, error)

func (*NullChannel) SendRequest

func (*NullChannel) SendRequest(name string, wantReply bool, payload []byte) (bool, error)

func (*NullChannel) Stderr

func (*NullChannel) Stderr() io.ReadWriter

func (*NullChannel) Write

func (*NullChannel) Write(data []byte) (int, error)

type NullConn

type NullConn struct{}

func (*NullConn) ClientVersion

func (*NullConn) ClientVersion() []byte

func (*NullConn) Close

func (*NullConn) Close() error

func (*NullConn) LocalAddr

func (*NullConn) LocalAddr() net.Addr

func (*NullConn) OpenChannel

func (*NullConn) OpenChannel(name string, data []byte) (ssh.Channel, <-chan *ssh.Request, error)

func (*NullConn) RemoteAddr

func (*NullConn) RemoteAddr() net.Addr

func (*NullConn) SendRequest

func (*NullConn) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error)

func (*NullConn) ServerVersion

func (*NullConn) ServerVersion() []byte

func (*NullConn) SessionID

func (*NullConn) SessionID() []byte

func (*NullConn) User

func (*NullConn) User() string

func (*NullConn) Wait

func (*NullConn) Wait() error

type NullReadWriter

type NullReadWriter struct{}

func (*NullReadWriter) Read

func (*NullReadWriter) Read(data []byte) (int, error)

func (*NullReadWriter) Write

func (*NullReadWriter) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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