Documentation
¶
Overview ¶
Package testenv contains common helpers for tests
Index ¶
- Constants
- func ApplyTemplate(k kubectl.Command, asset string, data interface{}) error
- func AssetPath(p ...string) string
- func CreateGitRepo(k kubectl.Command, namespace string, name string, branch string, ...) error
- func ExamplePath(p ...string) string
- func NewNamespaceName(name string, s rand.Source) string
- func RandomFilename(filename string, r *rand.Rand) string
- func Root() string
- func SetRoot(dir string)
- func Template(output string, tmplPath string, data any) error
- type Env
- type GitRepoData
Constants ¶
View Source
const Timeout = 5 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func ApplyTemplate ¶ added in v0.7.0
func ApplyTemplate(k kubectl.Command, asset string, data interface{}) error
ApplyTemplate templates a file and applies it to the cluster.
func CreateGitRepo ¶ added in v0.7.0
func CreateGitRepo(k kubectl.Command, namespace string, name string, branch string, paths ...string) error
CreateGitRepo uses the template to create a gitrepo resource. The namespace is the TargetNamespace for the workloads.
func ExamplePath ¶
func ExamplePath(p ...string) string
ExamplePath returns the path to the fleet examples
func NewNamespaceName ¶ added in v0.7.0
func NewNamespaceName(name string, s rand.Source) string
NewNamespaceName returns a name for a namespace that is unique to the test run. e.g. as a targetNamespace for workloads
func RandomFilename ¶ added in v0.5.0
func RandomFilename(filename string, r *rand.Rand) string
RandomName returns a slightly random name, so temporary assets don't conflict
Types ¶
type Env ¶
type Env struct {
Kubectl kubectl.Command
// Upstream context for cluster containing the fleet controller and local agent
Upstream string
// Downstream context for fleet-agent cluster
Downstream string
// Namespace which contains the cluster resource for most E2E tests
// (cluster registration namespace)
Namespace string
// Namespace which contains downstream clusters, besides the local
// cluster, for some multi-cluster E2E tests
ClusterRegistrationNamespace string
}
type GitRepoData ¶ added in v0.7.0
type GitRepoData struct {
Name string
Branch string
Paths []string
TargetNamespace string
}
GitRepoData can be used with the gitrepo-template.yaml asset when no custom GitRepo properties are required. All fields are required.
Click to show internal directories.
Click to hide internal directories.