Documentation ¶
Index ¶
- func CompareWithFixture(t *testing.T, output interface{}, opts ...Option)
- func CreateTempDirForTest(t *testing.T, dirName string) (string, error)
- func DetectClusterName(cfg *rest.Config, ctx context.Context, crdName string) (string, error)
- func GetClientForServer(ctx context.Context, server RunningServer, crdName string) (kubernetesclientset.Interface, error)
- func GetFreePort(t *testing.T) (string, error)
- func InProcessEnvSet() bool
- func InstallCluster(t *testing.T, ctx context.Context, source, server RunningServer, ...) error
- func InstallCrd(ctx context.Context, gr metav1.GroupResource, servers map[string]RunningServer, ...) error
- func InstallNamespace(ctx context.Context, server RunningServer, crdName, testNamespace string) error
- func NewExpecter(informer cache.SharedIndexInformer) *expectationController
- func NewPollingExpecter(interval time.Duration) *expectationController
- func ReadFromFixture(t *testing.T, identifier string) []byte
- func Ready(ctx context.Context, t *testing.T, port string) bool
- func RequireDiff(t *testing.T, x, y interface{}, msgAndArgs ...interface{})
- func RequireNoDiff(t *testing.T, x, y interface{}, msgAndArgs ...interface{})
- func RunInProcess(o *runOptions)
- func ScratchDirs(t *testing.T) (string, string, error)
- func WithLogStreaming(o *runOptions)
- func WriteToFixture(t *testing.T, identifier string, data []byte)
- type Accessory
- type Expectation
- type Expecter
- type KcpConfig
- type KcpFixture
- type Option
- type Options
- type RegisterWorkspaceExpectation
- type RegisterWorkspaceListExpectation
- type RegisterWorkspaceShardExpectation
- type RunOption
- type RunningServer
- type User
- type Users
- type WorkspaceExpectation
- type WorkspaceListExpectation
- type WorkspaceShardExpectation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareWithFixture ¶
CompareWithFixture will compare output with a test fixture and allows to automatically update them by setting the UPDATE env var. If output is not a []byte or string, it will get serialized as yaml prior to the comparison. The fixtures are stored in $PWD/testdata/prefix${testName}.yaml
func CreateTempDirForTest ¶
createTempDirForTest creates the named directory with a unique base path derived from the name of the current test.
func DetectClusterName ¶
DetectClusterName returns the name of the cluster that contains the desired CRD. TODO: we need to undo the prefixing and get normal sharding behavior in soon ... ?
func GetClientForServer ¶
func GetClientForServer(ctx context.Context, server RunningServer, crdName string) (kubernetesclientset.Interface, error)
GetClientForServer returns a kubernetes clientset for a given server.
func GetFreePort ¶
GetFreePort asks the kernel for a free open port that is ready to use.
func InProcessEnvSet ¶
func InProcessEnvSet() bool
func InstallCluster ¶
func InstallCluster(t *testing.T, ctx context.Context, source, server RunningServer, crdName, clusterName string) error
InstallCluster creates a new Cluster resource with the desired name on a given server and waits for it to be ready.
func InstallCrd ¶
func InstallCrd(ctx context.Context, gr metav1.GroupResource, servers map[string]RunningServer, embeddedResources embed.FS) error
InstallCrd installs a CRD on one or multiple servers.
func InstallNamespace ¶
func InstallNamespace(ctx context.Context, server RunningServer, crdName, testNamespace string) error
InstallNamespace creates a new namespace into the desired server.
func NewExpecter ¶
func NewExpecter(informer cache.SharedIndexInformer) *expectationController
NewExpecter creates a informer-driven registry of expectations, which will be triggered on every event that the informer ingests.
func NewPollingExpecter ¶
NewPollingExpecter creates a poll-driven registry of expectations, which will be triggered on every tick that the controller experiences. This is useful for resources which do not support WATCH and cannot use the expectationController
func ReadFromFixture ¶
ReadFromFixture reads an input fixture file and returns the data
func RequireDiff ¶
func RequireNoDiff ¶
func RunInProcess ¶
func RunInProcess(o *runOptions)
func ScratchDirs ¶
ScratchDirs determines where artifacts and data should live for a test server.
func WithLogStreaming ¶
func WithLogStreaming(o *runOptions)
Types ¶
type Accessory ¶
type Accessory struct {
// contains filtered or unexported fields
}
Accessory knows how to run an executable with arguments for the duration of the context.
type Expectation ¶
Expectation closes over a statement of intent, allowing the caller to accumulate errors and determine when the expectation should cease to be evaluated.
type Expecter ¶
type Expecter interface { // ExpectBefore will result in the Expectation being evaluated whenever // state changes, up until the desired timeout is reached. ExpectBefore(context.Context, Expectation, time.Duration) error }
Expecter allows callers to register expectations
type KcpFixture ¶
type KcpFixture struct {
Servers map[string]RunningServer
}
KcpFixture manages the lifecycle of a set of kcp servers.
func NewKcpFixture ¶
func NewKcpFixture(t *testing.T, cfgs ...KcpConfig) *KcpFixture
type RegisterWorkspaceExpectation ¶
type RegisterWorkspaceExpectation func(seed *tenancyv1alpha1.Workspace, expectation WorkspaceExpectation) error
RegisterWorkspaceExpectation registers an expectation about the future state of the seed.
func ExpectWorkspaces ¶
func ExpectWorkspaces(ctx context.Context, t *testing.T, client kcpclientset.Interface) (RegisterWorkspaceExpectation, error)
ExpectWorkspaces sets up an Expecter in order to allow registering expectations in tests with minimal setup.
type RegisterWorkspaceListExpectation ¶
type RegisterWorkspaceListExpectation func(expectation WorkspaceListExpectation) error
RegisterWorkspaceListExpectation registers an expectation about the future state of the system.
func ExpectWorkspaceListPolling ¶
func ExpectWorkspaceListPolling(ctx context.Context, t *testing.T, client kcpclientset.Interface) (RegisterWorkspaceListExpectation, error)
ExpectWorkspaceListPolling sets up an Expecter in order to allow registering expectations in tests with minimal setup.
type RegisterWorkspaceShardExpectation ¶
type RegisterWorkspaceShardExpectation func(seed *tenancyv1alpha1.WorkspaceShard, expectation WorkspaceShardExpectation) error
RegisterWorkspaceShardExpectation registers an expectation about the future state of the seed.
func ExpectWorkspaceShards ¶
func ExpectWorkspaceShards(ctx context.Context, t *testing.T, client kcpclientset.Interface) (RegisterWorkspaceShardExpectation, error)
ExpectWorkspaceShards sets up an Expecter in order to allow registering expectations in tests with minimal setup.
type RunningServer ¶
type WorkspaceExpectation ¶
type WorkspaceExpectation func(*tenancyv1alpha1.Workspace) error
WorkspaceExpectation evaluates an expectation about the object.
type WorkspaceListExpectation ¶
type WorkspaceListExpectation func(*tenancyv1alpha1.WorkspaceList) error
WorkspaceListExpectation evaluates an expectation about the object.
type WorkspaceShardExpectation ¶
type WorkspaceShardExpectation func(*tenancyv1alpha1.WorkspaceShard) error
WorkspaceShardExpectation evaluates an expectation about the object.