Documentation
¶
Index ¶
- func Find(slice []string, option string) (int, bool)
- func UpdateAdmintoolsCmd(passwd string, cmd ...string) []string
- func UpdateVsqlCmd(passwd string, cmd ...string) []string
- type ClusterPodRunner
- func (c *ClusterPodRunner) CopyToPod(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (c *ClusterPodRunner) ExecAdmintools(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (c *ClusterPodRunner) ExecInPod(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (c *ClusterPodRunner) ExecVSQL(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- type CmdHistory
- type CmdResult
- type CmdResults
- type FakePodRunner
- func (f *FakePodRunner) CopyToPod(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (f *FakePodRunner) ExecAdmintools(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (f *FakePodRunner) ExecInPod(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (f *FakePodRunner) ExecVSQL(ctx context.Context, podName types.NamespacedName, contName string, ...) (stdout, stderr string, err error)
- func (f *FakePodRunner) FindCommands(partialCmd ...string) []CmdHistory
- type PodRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateAdmintoolsCmd ¶
UpdateAdmintoolsCmd generates an admintools command appending the options we need
func UpdateVsqlCmd ¶
UpdateVsqlCmd generates a vsql command appending the options we need
Types ¶
type ClusterPodRunner ¶
func MakeClusterPodRunner ¶
MakeClusterPodRunnerr will build a ClusterPodRunner object
func (*ClusterPodRunner) CopyToPod ¶ added in v1.1.0
func (c *ClusterPodRunner) CopyToPod(ctx context.Context, podName types.NamespacedName, contName string, sourceFile string, destFile string) (stdout, stderr string, err error)
CopyToPod copies a file into a container's pod
func (*ClusterPodRunner) ExecAdmintools ¶
func (c *ClusterPodRunner) ExecAdmintools(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (stdout, stderr string, err error)
ExecAdmintools appends options to the admintools command and calls ExecInPod
type CmdHistory ¶
type CmdHistory struct { Pod types.NamespacedName Command []string }
CmdHistory stores the command that was run and the pod it was run against.
type CmdResults ¶
type CmdResults map[types.NamespacedName][]CmdResult
CmdResults stores the command result. The key is the pod name.
type FakePodRunner ¶
type FakePodRunner struct { // The fake result of calls made. This *must* be filled in prior to ExecInPod. Results CmdResults // The commands that were issue. The commands are in the same order that // commands were received. This is filled in by ExecInPod and can be inspected. Histories []CmdHistory // fake password SUPassword string }
FakePodRunner is stub that we use in testing to take output from exec calls. The CmdResult are prepopulated results to commands. Each command given is for a specific pod. This allows us to build up the result for each successive exec call to that pod. This class also keeps track of the commands that were passed to ExecInPod. These can be inspected at the end of the test to verify assertions.
func (*FakePodRunner) CopyToPod ¶ added in v1.1.0
func (f *FakePodRunner) CopyToPod(ctx context.Context, podName types.NamespacedName, contName string, sourceFile string, destFile string) (stdout, stderr string, err error)
CopyToPod will mimic a real copy file into a pod
func (*FakePodRunner) ExecAdmintools ¶
func (f *FakePodRunner) ExecAdmintools(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (stdout, stderr string, err error)
ExecAdmintools calls ExecInPod
func (*FakePodRunner) ExecInPod ¶
func (f *FakePodRunner) ExecInPod(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (stdout, stderr string, err error)
ExecInPod is a test stub for a real exec call to a pod. It will return output as saved in the FakePodRunner struct. The command that is passed in are saved as a history that tests can later inspect.
func (*FakePodRunner) ExecVSQL ¶
func (f *FakePodRunner) ExecVSQL(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (stdout, stderr string, err error)
ExecVSQL calls ExecInPod
func (*FakePodRunner) FindCommands ¶
func (f *FakePodRunner) FindCommands(partialCmd ...string) []CmdHistory
FindCommands will search through the command history for any command that contains the given partial command.
type PodRunner ¶
type PodRunner interface { ExecInPod(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (string, string, error) ExecVSQL(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (string, string, error) ExecAdmintools(ctx context.Context, podName types.NamespacedName, contName string, command ...string) (string, string, error) CopyToPod(ctx context.Context, podName types.NamespacedName, contName string, sourceFile string, destFile string) (stdout, stderr string, err error) }