Documentation
¶
Index ¶
- Variables
- func CheckEnv(keys ...string) (map[string]string, error)
- func CleanupNamespaces()
- func Colorf(format string, a ...any) string
- func FColorf(f io.Writer, format string, a ...any) error
- func FColorfln(f io.Writer, format string, a ...any) error
- func FindRepoRoot() (string, error)
- func PreflightChecks() error
- func RunCmd(t *testing.T, name string, args ...string)
- func RunCmdWithEnv(t *testing.T, env []string, name string, args ...string)
- func RunTestMain(m *testing.M) int
- type Clients
- type ColorWriter
- type IndentWriter
- type Namespace
Constants ¶
This section is empty.
Variables ¶
var ( RunE2E bool KubeConfig string KubeContext string )
var (
NoColor bool
)
noColor() disables colors for tests running in environments without colored output.
Functions ¶
func CheckEnv ¶
CheckEnv checks the list of env vars exist and returns their value. If any env var is not set, it returns an error.
func CleanupNamespaces ¶
func CleanupNamespaces()
CleanupNamespaces deletes all registered namespaces using the K8s API. This should be called at the end of RunTestMain.
func Colorf ¶
Colorf renders a formatted string with color directives:
"Example text: <green>this is green</green>".
Unterminated directives will be treated as literals.
func FColorfln ¶
FColorfln writes a formatted string with color directives to the given writer, followed by a newline.
func FindRepoRoot ¶
FindRepoRoot traverses directories upward starting from the current working directory to locate the repository root containing the go.mod file.
func PreflightChecks ¶
func PreflightChecks() error
PreflightChecks checks that the test environment is ready for the test suite.
func RunCmd ¶
RunCmd executes the given command with arguments, piping stdout and stderr to standard outputs, and fails the test if the command returns an error.
func RunCmdWithEnv ¶
RunCmdWithEnv executes the given command with custom environment variables appended to the current process environment, and fails the test if it returns an error.
func RunTestMain ¶
RunTestMain should be used to run your e2e test suite.
Types ¶
type Clients ¶
type Clients struct {
K8s *kubernetes.Clientset
CRD *apiextensionsclientset.Clientset
SubstrateK8s *versioned.Clientset
SubstrateAPI *client.Client
}
func GetClients ¶
func GetClients() *Clients
GetClients returns the shared E2E clients. It panics if the clients have not been initialized.
type ColorWriter ¶
ColorWriter wraps an io.Writer and forces all writes to be colored with the given ANSI code. It respects noColor().
type IndentWriter ¶
IndentWriter wraps an io.Writer and indents each line of output.
func NewIndentWriter ¶
func NewIndentWriter(w io.Writer, indent string) *IndentWriter
NewIndentWriter creates a new IndentWriter.
type Namespace ¶
type Namespace struct {
Name string
}
func CreateNamespace ¶
CreateNamespace creates a new namespace with a randomized name using the K8s API and registers it for cleanup at the end of the test.