test

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package test contains functionality that should be available to all unit tests (which live in separate packages).

Index

Constants

View Source
const PostgresTestUrl = "postgresql://testuser:testpassword@localhost:5432/test"

Variables

This section is empty.

Functions

func ClearAllTestStorage added in v0.5.0

func ClearAllTestStorage()

func ClearTestStorage

func ClearTestStorage(t *testing.T, client io.Closer, storage string)

ClearTestStorage removes any output from previously run tests.

func CreateTestStorage

func CreateTestStorage(t *testing.T) string

func FindTestdataFolder

func FindTestdataFolder(t *testing.T) string

FindTestdataFolder finds the "testdata" folder which is in . or .. depending on which package is calling us.

func HTTPGet added in v0.8.0

func HTTPGet(t *testing.T, client *http.Client, url string, headers http.Header, expectedStatus int, result interface{})

func HTTPPost added in v0.8.0

func HTTPPost(t *testing.T, client *http.Client, url, body string, headers http.Header, expectedStatus int, result interface{})

func NewHTTPClient added in v0.8.0

func NewHTTPClient() *http.Client

func RunScriptOnDB added in v0.8.0

func RunScriptOnDB(t *testing.T, filename string, allowErr bool)

func SetTestStorageDir added in v0.5.0

func SetTestStorageDir(dir string)

func SetupTestStorage

func SetupTestStorage(t *testing.T) string

func StartBadHttpServer

func StartBadHttpServer(count uint32, timeout time.Duration, success string)

StartBadHttpServer starts an HTTP server that times out and returns 500 on the first few times.

func StartSchemeManagerHttpServer

func StartSchemeManagerHttpServer()

func StopBadHttpServer

func StopBadHttpServer()

func StopSchemeManagerHttpServer

func StopSchemeManagerHttpServer()

Types

type Signer added in v0.11.0

type Signer struct {
	// contains filtered or unexported fields
}

func LoadSigner added in v0.11.0

func LoadSigner(t *testing.T, privateKey *ecdsa.PrivateKey) *Signer

func NewSigner added in v0.11.0

func NewSigner(t *testing.T) *Signer

func (*Signer) PublicKey added in v0.11.0

func (s *Signer) PublicKey(_ string) ([]byte, error)

func (*Signer) Sign added in v0.11.0

func (s *Signer) Sign(_ string, msg []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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