test

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTimeout added in v1.0.6

func ContextWithTimeout(tb testing.TB, timeout time.Duration) context.Context

ContextWithTimeout returns a context with a timeout that is cancelled when the test ends.

func GenerateCA added in v1.0.7

func GenerateCA(g *WithT) ([]byte, *x509.Certificate, *ecdsa.PrivateKey)

GenerateCA creates a new CA certificate and returns the PEM encoded certificate, the parsed certificate, and the private key

func GenerateKubeletCert added in v1.0.7

func GenerateKubeletCert(g *WithT, issuer *x509.Certificate, issuerKey *ecdsa.PrivateKey, validFrom, validTo time.Time) []byte

GenerateKubeletCert creates a new kubelet certificate signed by the given CA

func RunInstallTest added in v1.0.4

func RunInstallTest(t *testing.T, td TestData)

RunInstallTest runs the standard installation test suite

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 TestData added in v1.0.4

type TestData struct {
	ArtifactName    string
	BinaryName      string
	Data            []byte
	Install         func(context.Context, string, aws.Source, *tracker.Tracker) error
	Verify          func(*GomegaWithT, string, *tracker.Tracker)
	VerifyFilePaths []string
}

TestData represents the data needed to run an installation test

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 NewHTTPServer added in v1.0.3

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

NewHTTPServer creates a new TestServer without TLS. The server is automatically closed when the test ends.

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