testutil

package
v0.16.6 Latest Latest
Warning

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

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

Documentation

Overview

Package testutil implements utilities for testing. This package is not used by production code.

Index

Constants

This section is empty.

Variables

View Source
var DummyLog string

Functions

func NewProber added in v0.12.0

func NewProber(t testing.TB, u string) scheme.Prober

func NewStore

func NewStore(t testing.TB) *store.Store

func NewStoreWithConsole added in v0.11.0

func NewStoreWithConsole(t testing.TB, w io.Writer) *store.Store

func NewStoreWithLog

func NewStoreWithLog(t testing.TB) *store.Store

func RunAlert added in v0.12.0

func RunAlert(ctx context.Context, a scheme.Alerter, rec api.Record) []api.Record

func RunProbe added in v0.12.0

func RunProbe(ctx context.Context, p scheme.Prober) []api.Record

func StartTestServer

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

func XlsxEqual added in v0.16.0

func XlsxEqual(actual io.ReaderAt, actualSize int64, want io.ReaderAt, wantSize int64) (same bool)

Types

type Certificate

type Certificate struct {
	PrivateKey  *rsa.PrivateKey
	CertFile    string
	KeyFile     string
	Certificate *x509.Certificate
}

func NewCertificate

func NewCertificate(t *testing.T) Certificate

func (Certificate) Client

func (c Certificate) Client() *http.Client

type DummyReporter

type DummyReporter struct {
	sync.Mutex

	Records []api.Record
	Sources []*api.URL
	Actives []*api.URL
}

func (*DummyReporter) AssertActives added in v0.12.0

func (r *DummyReporter) AssertActives(t *testing.T, expects ...string)

func (*DummyReporter) DeactivateTarget added in v0.12.0

func (r *DummyReporter) DeactivateTarget(source *api.URL, targets ...*api.URL)

func (*DummyReporter) Report

func (r *DummyReporter) Report(source *api.URL, rec api.Record)

Jump to

Keyboard shortcuts

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