Documentation ¶
Index ¶
- type CLI
- func (oc *CLI) Args(args ...string) *CLI
- func (oc *CLI) DumpPodLogs(pods *corev1.PodList, extraLogArgs ...string)
- func (oc *CLI) DumpPodLogsSinceTime(ctx context.Context, sinceTime time.Time)
- func (oc *CLI) Namespace() string
- func (oc *CLI) Output() (string, error)
- func (oc *CLI) OutputToFile(filename string) (string, error)
- func (oc *CLI) Outputs() (string, string, error)
- func (oc *CLI) Run(commands ...string) *CLI
- func (oc CLI) WithExec(execPath string) *CLI
- func (oc CLI) WithNamespace(ns string) *CLI
- func (oc CLI) WithSubPath(subPath string) *CLI
- func (oc CLI) WithoutNamespace() *CLI
- type StateGatherer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI provides function to call the OpenShift CLI, which is using to simplify state gathering during tests. This wrapper was inspired by the openshift/origin version of a similar helper. Origin version https://github.com/openshift/origin/blob/1ec0eb3175f25b525abb39253528e230a9a85684/test/extended/util/client.go#L80
func (*CLI) DumpPodLogs ¶
DumpPodLogs will dump any pod logs within namespace.
func (*CLI) DumpPodLogsSinceTime ¶
DumpPodLogsSinceTime will dump any pod logs within namespace from the time provided.
func (*CLI) Namespace ¶
Namespace returns the name of the namespace used in the current test case. If the namespace is not set, an empty string is returned.
func (*CLI) Output ¶
Output executes the command and returns stdout/stderr combined into one string.
func (*CLI) OutputToFile ¶
OutputToFile executes the command and store output to a file.
func (*CLI) Outputs ¶
Outputs executes the command and returns the stdout/stderr output as separate strings.
func (*CLI) Run ¶
Run executes given OpenShift CLI command verb (iow. "oc <verb>"). This function also override the default 'stdout' to redirect all output to a buffer and prepare the global flags such as namespace and config path.
func (CLI) WithNamespace ¶
WithNamespace sets a new namespace.
func (CLI) WithSubPath ¶
WithSubPath sets a sub path for files with CLI output.
func (CLI) WithoutNamespace ¶
WithoutNamespace instructs the command should be invoked without adding --namespace parameter.
type StateGatherer ¶
type StateGatherer struct { CLI *CLI // contains filtered or unexported fields }
StateGatherer MAPI specific wrapper for the CLI helper Intended to provide helper functions for gathering MAPI specific resources as well as related pod logs.
func NewStateGatherer ¶
NewStateGatherer initializes StateGatherer.
func (*StateGatherer) GatherAll ¶
func (sg *StateGatherer) GatherAll() error
GatherAll invokes GatherResources and GatherPodLogs subsequently.
func (*StateGatherer) GatherPodLogs ¶
func (sg *StateGatherer) GatherPodLogs()
GatherPodLogs collects logs from pods in MAPI-related namespaces since a particular time. Skips file creation if no new logs since time were found there. Store files into '%CLI.outputBasePath%/%test_name%/logs'.
func (*StateGatherer) GatherResources ¶
func (sg *StateGatherer) GatherResources() error
GatherResources helper method to collect MAPI-specific resources such as Machines, MachineSets, Nodes, Autoscalers, and so on. Store files into '%CLI.outputBasePath%/%test_name%/resources'.
func (StateGatherer) WithSinceTime ¶
func (sg StateGatherer) WithSinceTime(time time.Time) *StateGatherer
WithSinceTime sinceTime parameter for the StateGatherer. Uses to indicate test start time and collect logs only since then.
func (StateGatherer) WithSpecReport ¶
func (sg StateGatherer) WithSpecReport(specReport ginkgo.SpecReport) *StateGatherer
WithSpecReport sets ginkgo spec report for the StateGatherer instance. This test description uses to extract the test name and store relevant data in a respective sub-folder.