util

package
v0.0.0-...-2af547a Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateValidator

func GenerateValidator(
	validate func(json.Unmarshaler) error,
) (string, error)

GenerateValidator registers a specialty resource type that can be used to test config behavior of another resource type as part of resource unmarshaling.

Types

type ConfigTest

type ConfigTest struct {
	ResourceType     string
	IsValid          func(json.Unmarshaler) error
	SyntacticallyBad []ConfigTestData
	SemanticallyBad  []ConfigTestData
	Good             []ConfigTestData
	ListenerTest     bool
}

ConfigTest represents an entire suite of tests for config behavior of a particular resource type.

func (*ConfigTest) Run

func (c *ConfigTest) Run(t *testing.T)

Run executes the suite of config behavior tests.

type ConfigTestData

type ConfigTestData struct {
	Data        string
	Explanation string
}

ConfigTestData contains the data for a specific test case for config behavior, plus the corresponding explanation string.

type TestHandler

type TestHandler struct {
}

TestHandler is a dummy net/http.Handler implementation that can be used for testing.

func (*TestHandler) ServeHTTP

func (t *TestHandler) ServeHTTP(http.ResponseWriter, *http.Request)

ServeHTTP implements net/http.Handler.

func (*TestHandler) UnmarshalJSON

func (t *TestHandler) UnmarshalJSON([]byte) error

UnmarshalJSON implements encoding/json.Unmarshaler.

type TestListener

type TestListener struct {
}

TestListener is a dummy net.Listener that can be used for testing.

func (*TestListener) Accept

func (t *TestListener) Accept() (net.Conn, error)

Accept implements net.Listener.

func (*TestListener) Addr

func (t *TestListener) Addr() net.Addr

Addr implements net.Listener.

func (*TestListener) Close

func (t *TestListener) Close() error

Close implements net.Listener.

func (*TestListener) UnmarshalJSON

func (t *TestListener) UnmarshalJSON([]byte) error

UnmarshalJSON implements encoding/json.Unmarshaler.

Jump to

Keyboard shortcuts

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