util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BasedKongAdminAPIAddr = kong.String("http://localhost:8001")
View Source
var (

	// TestBackoff retries every second for 30 seconds and then gives up.
	TestBackoff backoff.BackOff
)

Functions

func CleanDB

func CleanDB(t *testing.T) error

func EnsureConfig

func EnsureConfig(expectedConfig *model.TestingConfig) error

func GenerateCertificate

func GenerateCertificate(bits int) (publicKey string, privateKey string, err error)

GenerateCertificate creates a random certificate with the given amount of bits, and returns the PEM encoded public & private keys.

func GetPersister

func GetPersister(t *testing.T) (persistence.Persister, error)

func JSONSubset

func JSONSubset(o1, o2 interface{}) error

func SkipTestIfEnterpriseTesting

func SkipTestIfEnterpriseTesting(t *testing.T, skip bool)

SkipTestIfEnterpriseTesting skips OSS test when skip is true and KOKO_TEST_ENTERPRISE_TESTING environment variable is set to true.

func WaitFor

func WaitFor(t *testing.T, port int, method, path, component string,
	wantHTTPCode int,
) error

func WaitForAdminAPI

func WaitForAdminAPI(t *testing.T) error

func WaitForKong

func WaitForKong(t *testing.T) error

func WaitForKongAdminAPI

func WaitForKongAdminAPI(t *testing.T) error

func WaitForKongPort

func WaitForKongPort(t *testing.T, port int) error

func WaitFunc

func WaitFunc(t *testing.T, fn func() error)

Types

type KongConfig

type KongConfig struct {
	Services       []*kong.Service       `json:"services,omitempty"`
	Routes         []*kong.Route         `json:"routes,omitempty"`
	Plugins        []*kong.Plugin        `json:"plugins,omitempty"`
	Upstreams      []*kong.Upstream      `json:"upstreams,omitempty"`
	Targets        []*kong.Target        `json:"targets,omitempty"`
	Consumers      []*kong.Consumer      `json:"consumers,omitempty"`
	Certificates   []*kong.Certificate   `json:"certificates,omitempty"`
	CACertificates []*kong.CACertificate `json:"ca_certificates,omitempty"`
	SNIs           []*kong.SNI           `json:"snis,omitempty"`
}

Jump to

Keyboard shortcuts

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