test_utils

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHelmDir

func CreateHelmDir(t *testing.T, name string, version string, dest string)

Types

type CallbackHandler

type CallbackHandler func(request admission.Request)

type CallbackHandlerEntry

type CallbackHandlerEntry struct {
	GVR      schema.GroupVersionResource
	Callback CallbackHandler
}

type EnvTestCluster

type EnvTestCluster struct {
	CRDDirectoryPaths []string

	Kubeconfig []byte
	Context    string

	HttpClient    *http.Client
	DynamicClient dynamic.Interface
	Client        client.WithWatch
	ServerVersion *version.Info
	// contains filtered or unexported fields
}

func CreateEnvTestCluster

func CreateEnvTestCluster(context string) *EnvTestCluster

func (*EnvTestCluster) AddUser added in v2.21.0

func (c *EnvTestCluster) AddUser(user envtest.User, baseConfig *rest.Config) (*envtest.AuthenticatedUser, error)

func (*EnvTestCluster) AddWebhookHandler

func (*EnvTestCluster) Apply added in v2.24.0

func (*EnvTestCluster) ApplyStatus added in v2.24.0

func (c *EnvTestCluster) ApplyStatus(o *uo.UnstructuredObject) error

func (*EnvTestCluster) Get

func (*EnvTestCluster) InitWebhookCallback

func (k *EnvTestCluster) InitWebhookCallback(gvr schema.GroupVersionResource, isNamespaced bool)

func (*EnvTestCluster) List

func (c *EnvTestCluster) List(gvr schema.GroupVersionResource, namespace string, labels map[string]string) ([]*uo.UnstructuredObject, error)

func (*EnvTestCluster) MustApply added in v2.24.0

func (c *EnvTestCluster) MustApply(t *testing.T, o *uo.UnstructuredObject)

func (*EnvTestCluster) MustApplyStatus added in v2.24.0

func (c *EnvTestCluster) MustApplyStatus(t *testing.T, o *uo.UnstructuredObject)

func (*EnvTestCluster) MustGet

func (c *EnvTestCluster) MustGet(t *testing.T, gvr schema.GroupVersionResource, namespace string, name string) *uo.UnstructuredObject

func (*EnvTestCluster) MustGetCoreV1

func (c *EnvTestCluster) MustGetCoreV1(t *testing.T, resource string, namespace string, name string) *uo.UnstructuredObject

func (*EnvTestCluster) RESTConfig

func (c *EnvTestCluster) RESTConfig() *rest.Config

RESTConfig returns K8s client config to pass to clientset objects

func (*EnvTestCluster) RemoveWebhookHandler

func (k *EnvTestCluster) RemoveWebhookHandler(e *CallbackHandlerEntry)

func (*EnvTestCluster) Start

func (k *EnvTestCluster) Start() error

func (*EnvTestCluster) Stop

func (c *EnvTestCluster) Stop()

type RepoChart

type RepoChart struct {
	ChartName string
	Version   string
}

type TCPProxy added in v2.22.0

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

TCPProxy is a proxy for TCP connections. It implements the Proxy interface to handle TCP traffic forwarding between the frontend and backend addresses.

func NewTCPProxy added in v2.22.0

func NewTCPProxy(listener net.Listener, backendAddr *net.TCPAddr, ops ...func(*TCPProxy)) (*TCPProxy, error)

NewTCPProxy creates a new TCPProxy.

func (*TCPProxy) BackendAddr added in v2.22.0

func (proxy *TCPProxy) BackendAddr() net.Addr

BackendAddr returns the TCP proxied address.

func (*TCPProxy) Close added in v2.22.0

func (proxy *TCPProxy) Close()

Close stops forwarding the traffic.

func (*TCPProxy) FrontendAddr added in v2.22.0

func (proxy *TCPProxy) FrontendAddr() net.Addr

FrontendAddr returns the TCP address on which the proxy is listening.

func (*TCPProxy) Run added in v2.22.0

func (proxy *TCPProxy) Run()

Run starts forwarding the traffic using TCP.

type TestGitServer added in v2.22.0

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

func NewTestGitServer added in v2.22.0

func NewTestGitServer(t *testing.T, opts ...TestGitServerOpt) *TestGitServer

func (*TestGitServer) Cleanup added in v2.22.0

func (p *TestGitServer) Cleanup()

func (*TestGitServer) CommitFiles added in v2.22.0

func (p *TestGitServer) CommitFiles(repo string, add []string, all bool, message string)

func (*TestGitServer) CommitYaml added in v2.22.0

func (p *TestGitServer) CommitYaml(repo string, pth string, message string, o map[string]any)

func (*TestGitServer) DeleteFile added in v2.22.0

func (p *TestGitServer) DeleteFile(repo string, pth string, message string)

func (*TestGitServer) GetGitRepo added in v2.22.0

func (p *TestGitServer) GetGitRepo(repo string) *git.Repository

func (*TestGitServer) GetWorktree added in v2.22.0

func (p *TestGitServer) GetWorktree(repo string) *git.Worktree

func (*TestGitServer) GitHost added in v2.22.0

func (p *TestGitServer) GitHost() string

func (*TestGitServer) GitInit added in v2.22.0

func (p *TestGitServer) GitInit(repo string)

func (*TestGitServer) GitRepoUrl added in v2.22.0

func (p *TestGitServer) GitRepoUrl(repo string) string

func (*TestGitServer) GitUrl added in v2.22.0

func (p *TestGitServer) GitUrl() string

func (*TestGitServer) LocalGitDir added in v2.23.0

func (p *TestGitServer) LocalGitDir(repo string) string

func (*TestGitServer) LocalWorkDir added in v2.23.0

func (p *TestGitServer) LocalWorkDir(repo string) string

func (*TestGitServer) ReadFile added in v2.23.0

func (p *TestGitServer) ReadFile(repo string, pth string) []byte

func (*TestGitServer) UpdateFile added in v2.22.0

func (p *TestGitServer) UpdateFile(repo string, pth string, update func(f string) (string, error), message string)

func (*TestGitServer) UpdateYaml added in v2.22.0

func (p *TestGitServer) UpdateYaml(repo string, pth string, update func(o map[string]any) error, message string)

type TestGitServerOpt added in v2.22.0

type TestGitServerOpt func(*TestGitServer)

func WithTestGitServerAuth added in v2.22.0

func WithTestGitServerAuth(username string, password string) TestGitServerOpt

func WithTestGitServerFailWhenAuth added in v2.22.0

func WithTestGitServerFailWhenAuth(fail bool) TestGitServerOpt

type TestHelmRepo added in v2.22.0

type TestHelmRepo struct {
	TestHttpServer

	Oci bool

	Path   string
	Charts []RepoChart

	URL url.URL
}

func (*TestHelmRepo) Start added in v2.22.0

func (s *TestHelmRepo) Start(t *testing.T)

type TestHttpServer added in v2.22.0

type TestHttpServer struct {
	TLSEnabled             bool
	TLSClientCertEnabled   bool
	NoLoopbackProxyEnabled bool

	Username string
	Password string

	Server     *httptest.Server
	ServerCAs  []byte
	ClientCAs  []byte
	ClientCert []byte
	ClientKey  []byte
}

func (*TestHttpServer) Start added in v2.22.0

func (s *TestHttpServer) Start(t *testing.T, h http.Handler)

Directories

Path Synopsis
This is copied from https://github.com/sosedoff/gitkit and simplified
This is copied from https://github.com/sosedoff/gitkit and simplified

Jump to

Keyboard shortcuts

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