framework

package
v0.29.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 39 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTokenAuthFile string

DefaultTokenAuthFile returns the default auth tokens file.

Functions

func AdmitWorkspaceAccess added in v0.6.0

func AdmitWorkspaceAccess(ctx context.Context, t *testing.T, kubeClusterClient kcpkubernetesclientset.ClusterInterface, clusterName logicalcluster.Path, users []string, groups []string, admin bool)

AdmitWorkspaceAccess create RBAC rules that allow the given users and/or groups to access the given workspace, optionally as admin.

func ConfigWithToken added in v0.6.0

func ConfigWithToken(token string, cfg *rest.Config) *rest.Config

ConfigWithToken returns a copy of the given rest.Config with the given token set.

func ExportVirtualWorkspaceURLs added in v0.11.0

func ExportVirtualWorkspaceURLs(export *apisv1alpha1.APIExportEndpointSlice) []string

ExportVirtualWorkspaceURLs returns the URLs of the virtual workspaces of the given APIExportEndpointSlice.

func KcpCliPluginCommand added in v0.6.0

func KcpCliPluginCommand() []string

KcpCliPluginCommand returns the cli args to run the workspace plugin directly or via go run (depending on whether NO_GORUN is set).

func Kubectl added in v0.6.0

func Kubectl(t *testing.T, kubeconfigPath string, args ...string) []byte

Kubectl runs kubectl with the given arguments and returns the combined stderr and stdout.

func KubectlApply added in v0.6.0

func KubectlApply(t *testing.T, kubeconfigPath string, input []byte) []byte

KubectlApply runs kubectl apply -f with the supplied input piped to stdin and returns the combined stderr and stdout output.

func NewOrganizationFixture deprecated added in v0.6.0

NewOrganizationFixture creates a workspace under root.

Deprecated: use NewWorkspaceFixture with WithType(core.RootCluster.Path(), "organization") instead. There is no organization concept in kcp.

func NewRootShardOrganizationFixture added in v0.27.0

func NewRootShardOrganizationFixture[O kcptesting.WorkspaceOption](t *testing.T, server kcptestingserver.RunningServer, options ...O) (logicalcluster.Path, *tenancyv1alpha1.Workspace)

NewRootShardOrganizationFixture creates an organization workspace on the root shard.

func ReplicationVirtualWorkspaceURLs added in v0.28.0

func ReplicationVirtualWorkspaceURLs(slice *cachev1alpha1.CachedResourceEndpointSlice) []string

ReplicationVirtualWorkspaceURLs returns the URLs of the virtual workspaces of the given CachedResourceEndpointSlice.

func RunKcpCliPlugin added in v0.6.0

func RunKcpCliPlugin(t *testing.T, kubeconfigPath string, subcommand []string) []byte

RunKcpCliPlugin runs the kcp workspace plugin with the provided subcommand and returns the combined stderr and stdout output.

func StaticTokenUserConfig added in v0.11.0

func StaticTokenUserConfig(username string, cfg *rest.Config) *rest.Config

StaticTokenUserConfig returns a user config based on static user tokens defined in "test/e2e/framework/auth-tokens.csv". The token being used is "[username]-token".

func Suite added in v0.10.0

func Suite(t *testing.T, suite string)

Suite should be called at the very beginning of a test case, to ensure that a test is only run when the suite containing it is selected by the user running tests.

func UniqueGroup added in v0.7.0

func UniqueGroup(suffix string) string

UniqueGroup returns a unique API group with the given suffix by prefixing some random 8 character base36 string. suffix must start with a dot if the random string should be dot-separated.

func VirtualWorkspaceURL added in v0.11.0

func VirtualWorkspaceURL(ctx context.Context, kcpClusterClient kcpclientset.ClusterInterface, ws *tenancyv1alpha1.Workspace, urls []string) (string, bool, error)

VirtualWorkspaceURL returns the virtual workspace URL base URL of the shard the workspace is scheduled on.

func WithRequiredGroups added in v0.11.0

func WithRequiredGroups(groups ...string) testing2.PrivilegedWorkspaceOption

WithRequiredGroups is a privileged action, so we return a privileged option type, and only the helpers that use the system:master config can consume this. However, workspace initialization requires a valid user annotation on the workspace object to impersonate during initialization, and system:master bypasses setting that, so we end up needing to hard-code something conceivable.

Types

type ArtifactFunc added in v0.6.0

type ArtifactFunc func(*testing.T, func() (runtime.Object, error))

Jump to

Keyboard shortcuts

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