Documentation ¶
Index ¶
- type HelmClient
- type OCIClient
- type TestShell
- func (tc *TestShell) Command(name string, args ...string) *exec.Cmd
- func (tc *TestShell) ExecWithDebug(name string, args ...string) ([]byte, error)
- func (tc *TestShell) Gcloud(args ...string) ([]byte, error)
- func (tc *TestShell) Kubectl(args ...string) ([]byte, error)
- func (tc *TestShell) KubectlContext(ctx context.Context, args ...string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HelmClient ¶ added in v1.18.0
type HelmClient struct { // DockerConfig is the value to use for DOCKER_CONFIG. // Crane uses DOCKER_CONFIG for auth settings. // Helm uses DOCKER_CONFIG for default auth settings, when not specified in // HELM_REGISTRY_CONFIG. DockerConfig string // ConfigHome is the value to use for HELM_CONFIG_HOME. // // Defaults: // - Linux: ${HOME}/.config/helm // - Mac: ${HOME}/Library/Preferences/helm // https://github.com/helm/helm/blob/main/pkg/helmpath/lazypath_darwin.go#L28 // - Windows: ${APPDATA}/helm // https://github.com/helm/helm/blob/main/pkg/helmpath/lazypath_windows.go#L22 // // Affects default values for HELM_REGISTRY_CONFIG, HELM_REPOSITORY_CONFIG // HELM_REPOSITORY_CACHE, and HELM_CACHE_HOME. ConfigHome string // Shell used to execute helm and crane client commands. Shell *TestShell }
HelmClient provides helm and crane clients for connecting to an Helm repository.
func NewHelmClient ¶ added in v1.18.0
func NewHelmClient(parentPath string, shell *TestShell) *HelmClient
NewHelmClient constructs a new HelmClient that stores config in sub-directories under the specified `parentPath`.
func (*HelmClient) Crane ¶ added in v1.18.0
func (hc *HelmClient) Crane(args ...string) ([]byte, error)
Crane executes a crane command with the HelmClient's config.
func (*HelmClient) Helm ¶ added in v1.18.0
func (hc *HelmClient) Helm(args ...string) ([]byte, error)
Helm executes a helm command with the HelmClient's config.
func (*HelmClient) Login ¶ added in v1.18.0
func (hc *HelmClient) Login(registryHost string) error
Login uses gcloud to configure docker auth credentials used by helm and crane.
Files modified: - `${DOCKER_CONFIG}/config.json` (crane/docker)
func (*HelmClient) Logout ¶ added in v1.18.0
func (hc *HelmClient) Logout(registryHost string) error
Logout removes credentials for the specified registry.
Files modified: - `${DOCKER_CONFIG}/config.json` (crane/docker) - `${HELM_CONFIG_HOME}/registry/config.json` (helm)
type OCIClient ¶ added in v1.18.0
type OCIClient struct { // DockerConfig is the value to use for DOCKER_CONFIG. // Crane uses DOCKER_CONFIG for auth settings. DockerConfig string // Shell used to execute crane client commands. Shell *TestShell }
OCIClient provides a crane client for connecting to an OCI repository.
func NewOCIClient ¶ added in v1.18.0
NewOCIClient constructs a new OCIClient that stores config in sub-directories under the specified `parentPath`.
func (*OCIClient) Crane ¶ added in v1.18.0
Crane executes a crane command with the OCIClient's config.
type TestShell ¶
type TestShell struct { // Context to use, if not specified by the method. Context context.Context // Env to use for all commands, if non-nil. // Default: os.Environ() Env []string // Logger for methods to use. Logger *testlogger.TestLogger }
TestShell is a helper utility to execute shell commands in a test. Handles logging and injection of the KUBECONFIG as argument or env var.
func (*TestShell) Command ¶
Command is a convenience method for invoking a subprocess with the KUBECONFIG environment variable set. Setting the environment variable directly in the test process is not thread safe.
func (*TestShell) ExecWithDebug ¶ added in v1.17.0
ExecWithDebug is a convenience method for invoking a subprocess with the KUBECONFIG environment variable and debug logging.
func (*TestShell) Gcloud ¶ added in v1.18.0
Gcloud is a convenience method for calling gcloud against the currently-connected cluster. Returns STDOUT/STDERR, and an error if gcloud exited abnormally.
If you want to fail the test immediately on failure, wrap with nt.Must.