Documentation
¶
Index ¶
- Constants
- func Artifact(opts *Options, relPath string) (*os.File, error)
- func ArtifactDirectoryFor(t *testing.T) string
- func CertKeyRequest(t *testing.T, signer certificates.SignerClass) ([]byte, []byte, []byte, []byte)
- func CleanupSentinel(_ context.Context) error
- func CommonNameFor(signer certificates.SignerClass) string
- func GetFreePort(ctx context.Context, logger logr.Logger, opts *Options, t *testing.T) (string, error)
- func HostedClusterFor(t *testing.T) string
- func InterruptableContext(parent context.Context) context.Context
- func LoadKubeConfig(path string) (*rest.Config, error)
- func Run(ctx context.Context, logger logr.Logger, globalOpts *Options, t *testing.T, ...)
- func RunCommand(logger logr.Logger, opts *Options, logPath string, cmd *exec.Cmd) error
- func SkippedCleanupSteps() sets.Set[string]
- func StartCommand(logger logr.Logger, opts *Options, logPath string, cmd *exec.Cmd) error
- func WaitForGuestRestConfig(ctx context.Context, logger logr.Logger, opts *Options, t *testing.T, ...) (*rest.Config, error)
- type Builder
- type Cleanup
- func InstallAssets(ctx context.Context, logger logr.Logger, opts *Options) (Cleanup, error)
- func InstallHostedCluster(ctx context.Context, logger logr.Logger, opts *Options, t *testing.T, ...) (Cleanup, error)
- func InstallHyperShiftOperator(ctx context.Context, logger logr.Logger, opts *Options) (Cleanup, error)
- func WaitForHyperShiftOperator(ctx context.Context, logger logr.Logger, opts *Options) (Cleanup, error)
- type Clients
- type InjectKubeconfigMode
- type Mode
- type Options
- type TestContext
Constants ¶
const HostedClusterNamespace = "hosted-clusters"
Variables ¶
This section is empty.
Functions ¶
func Artifact ¶
Artifact opens relPath under the artifact dir, ensuring that owning directories exist. Closing the file is the responsibility of the caller.
func ArtifactDirectoryFor ¶
ArtifactDirectoryFor transforms t.Name() into a string that can be used for a directory name. Adapted from the core testutil golden fixture logic.
func CertKeyRequest ¶
func CertKeyRequest(t *testing.T, signer certificates.SignerClass) ([]byte, []byte, []byte, []byte)
func CleanupSentinel ¶
CleanupSentinel is a helper for returning a no-op cleanup function.
func CommonNameFor ¶ added in v0.1.20
func CommonNameFor(signer certificates.SignerClass) string
func GetFreePort ¶
func GetFreePort(ctx context.Context, logger logr.Logger, opts *Options, t *testing.T) (string, error)
GetFreePort asks the kernel for a free open port that is ready to use.
func HostedClusterFor ¶
HostedClusterFor hashes t.Name() to create a name for the HostedCluster. base36(sha224(value)) produces a useful, deterministic value that fits the requirements to be a Kubernetes object name (honoring length requirement, is a valid DNS subdomain, etc)
func LoadKubeConfig ¶
LoadKubeConfig loads a kubeconfig from the file and uses the default context
func RunCommand ¶
func SkippedCleanupSteps ¶
SkippedCleanupSteps parses $SKIP_CLEANUP as a comma-delimited list of cleanup steps to skip.
func StartCommand ¶
func WaitForGuestRestConfig ¶
func WaitForGuestRestConfig(ctx context.Context, logger logr.Logger, opts *Options, t *testing.T, hc *hypershiftv1beta1.HostedCluster) (*rest.Config, error)
WaitForGuestRestConfig returns the raw content of a KubeConfig for the guest cluster's API server. In order to get connectivity to the server, we start a process that port-forwards to the Service.
Types ¶
type Cleanup ¶
func InstallAssets ¶
InstallAssets applies static assets to the cluster for setup.
A closure is returned that knows how to clean this emulated process up.
func InstallHostedCluster ¶
func InstallHostedCluster(ctx context.Context, logger logr.Logger, opts *Options, t *testing.T, args ...string) (Cleanup, error)
InstallHostedCluster generates and applies assets to the cluster for setup of a HostedCluster.
A closure is returned that knows how to clean this emulated process up.
func InstallHyperShiftOperator ¶
func InstallHyperShiftOperator(ctx context.Context, logger logr.Logger, opts *Options) (Cleanup, error)
InstallHyperShiftOperator generates and applies assets to the cluster for setup of the HyperShift Operator.
A closure is returned that knows how to clean this emulated process up.
type Clients ¶
type Clients struct {
Cfg *rest.Config
KubeClient kubernetes.Interface
HyperShiftClient hypershiftclient.Interface
CRClient controllerruntimeclient.Client
}
type InjectKubeconfigMode ¶
type InjectKubeconfigMode string
const ( InjectKubeconfigFlag InjectKubeconfigMode = "flag" InjectKubeconfigEnv InjectKubeconfigMode = "env" )
type Mode ¶
type Mode string
Mode describes what the test process should be doing.
const ( // SetupMode sets up the HyperShift Operator, HostedClusters, and other infrastructure // but does not run any test code. Test processes will wait on SIGINT after setup is // complete, and run cleanup when interrupted. SetupMode Mode = "setup" // TestMode runs test code and expects the environment to already be set up. TestMode Mode = "test" // AllInOneMode is the default mode, where the process expects to both set up // the test environment and run the test code. AllInOneMode Mode = "all-in-one" )
type Options ¶
type Options struct {
OCPath string
HyperShiftCLIPath string
HyperShiftOperatorImage string
ControlPlaneOperatorImage string
ControlPlaneOperatorImageLabels string
ReleaseImage string
Kubeconfig string
ArtifactDir string
PullSecret string
Mode Mode
}
Options are global test options applicable to all scenarios.
func DefaultOptions ¶
func DefaultOptions() *Options
type TestContext ¶
type TestContext struct {
Opts *Options
HostedCluster *hypershiftv1beta1.HostedCluster
MgmtCluster *Clients
GuestCluster *Clients
}