Documentation
¶
Index ¶
- Variables
- func AdmitWorkspaceAccess(ctx context.Context, t *testing.T, ...)
- func ConfigWithToken(token string, cfg *rest.Config) *rest.Config
- func ExportVirtualWorkspaceURLs(export *apisv1alpha1.APIExportEndpointSlice) []string
- func KcpCliPluginCommand(plugin string) (string, []string, error)
- func NewOrganizationFixture(t *testing.T, server kcptestingserver.RunningServer, ...) (logicalcluster.Path, *tenancyv1alpha1.Workspace)deprecated
- func NewRootShardOrganizationFixture[O kcptesting.WorkspaceOption](t *testing.T, server kcptestingserver.RunningServer, options ...O) (logicalcluster.Path, *tenancyv1alpha1.Workspace)
- func ReplicationVirtualWorkspaceURLs(slice *cachev1alpha1.CachedResourceEndpointSlice) []string
- func RunKcpCliPlugin(t kcptesting.TestingT, kubeconfigPath string, plugin string, args []string) (*bytes.Buffer, *bytes.Buffer, error)
- func StaticTokenUserConfig(username string, cfg *rest.Config) *rest.Config
- func Suite(t *testing.T, suite string)
- func UniqueGroup(suffix string) string
- func VirtualWorkspaceURL(ctx context.Context, kcpClusterClient kcpclientset.ClusterInterface, ...) (string, bool, error)
- func WithRequiredGroups(groups ...string) testing2.PrivilegedWorkspaceOption
- type ArtifactFunc
- type TestCli
Constants ¶
This section is empty.
Variables ¶
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
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
KcpCliPluginCommand returns the expected workdir and cli args to run a plugin via go run.
func NewOrganizationFixture
deprecated
added in
v0.6.0
func NewOrganizationFixture(t *testing.T, server kcptestingserver.RunningServer, options ...kcptesting.UnprivilegedWorkspaceOption) (logicalcluster.Path, *tenancyv1alpha1.Workspace)
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 kcptesting.TestingT, kubeconfigPath string, plugin string, args []string) (*bytes.Buffer, *bytes.Buffer, error)
RunKcpCliPlugin runs the kcp plugin with the provided args and returns stdout and stderr as bytes.Buffer and an error if any. The exitcode can be retreived from the error if it is of type *exec.ExitError.
func StaticTokenUserConfig ¶ added in v0.11.0
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
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
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 TestCli ¶ added in v0.31.0
type TestCli struct {
Server kcptestingserver.RunningServer
KubeconfigPath string
}