test

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeInformer

type FakeInformer struct {
	// Started indicates if Starting was called.
	Started bool
	// DoneWith is the error passed to Done.
	DoneWith error
}

FakeInformer is a fake implementation of validation.Informer.

func NewFakeInformer

func NewFakeInformer() *FakeInformer

NewFakeInformer returns a FakeInformer.

func (*FakeInformer) Done

func (f *FakeInformer) Done(ctx context.Context, name string, err error)

func (*FakeInformer) Starting

func (f *FakeInformer) Starting(ctx context.Context, name, message string)

type TestServer

type TestServer struct {
	*httptest.Server
}

TestServer is a wrapper around httptest.Server.

func NewEKSDescribeClusterAPI

func NewEKSDescribeClusterAPI(tb testing.TB, resp *eks.DescribeClusterOutput) TestServer

NewEKSDescribeClusterAPI creates a new TestServer that behaves like the EKS DescribeCluster API.

func NewHTTPSServer

func NewHTTPSServer(tb testing.TB, handle func(w http.ResponseWriter, r *http.Request)) TestServer

NewHTTPSServer creates a new TestServer with a TLS certificate. The server is automatically closed when the test ends.

func NewHTTPSServerForJSON

func NewHTTPSServerForJSON(tb testing.TB, status int, resp any) TestServer

NewHTTPSServerForJSON creates a new TestServer that responds with a JSON body.

func (TestServer) CAPEM

func (s TestServer) CAPEM() []byte

CAPEM returns the PEM-encoded certificate of the server.

func (TestServer) Port

func (s TestServer) Port() (int, error)

Port returns the port the server is listening on.

Jump to

Keyboard shortcuts

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