Documentation
¶
Index ¶
- Constants
- func Boolp(value bool) *bool
- func RunScenario(scenario TestScenario) (string, string, error)
- func RunScenarios(t *testing.T, scenarios []TestScenario)
- func RunScenariosParallel(t *testing.T, scenarios []TestScenario)
- func RunSkupperCli(args []string) (string, string, error)
- func SkupperCommonOptions(cluster *base.ClusterContext) []string
- type DeleteTester
- type ErrorHookFunction
- type Expect
- type ExposeTester
- type InitTester
- func (s *InitTester) Command(cluster *base.ClusterContext) []string
- func (s *InitTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
- func (s *InitTester) ValidateConsole(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateConsoleIngress(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateIngress(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateRouterDebugMode(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateRouterLogging(cluster *base.ClusterContext) error
- type RevokeAccessTester
- type SkupperCommandTester
- type SkupperTask
- type StatusTester
- type TestScenario
- type UnexposeTester
- type VersionTester
Constants ¶
const (
SkupperBinary = "skupper"
)
Variables ¶
This section is empty.
Functions ¶
func Boolp ¶
Returns a pointer to a boolean value.
Some structures use nil to mark undefined values, and they use this to return a boolean when the value is defined.
func RunScenario ¶
func RunScenario(scenario TestScenario) (string, string, error)
Helper function that runs all tasks for a given scenario against the specified cluster. If an error occurs, it stops processing the remaining tasks.
func RunScenarios ¶
func RunScenarios(t *testing.T, scenarios []TestScenario)
func RunScenariosParallel ¶
func RunScenariosParallel(t *testing.T, scenarios []TestScenario)
Runs a list of []TestScenario in parallel. Each scenario will run in parallel to the other. However, the RunScenariosParallel call will only return when all of them finish. This allows the caller function to do further test steps that depend on the RunScenariosParallel items finishing.
To implement and signify that in the output, the steps are enclosed in a test called simply 'parallel'.
func RunSkupperCli ¶
RunSkupperCli executes the skupper binary (assuming it is available in the PATH), returning stdout, stderr and error.
func SkupperCommonOptions ¶
func SkupperCommonOptions(cluster *base.ClusterContext) []string
SkupperCommonOptions returns a list of all options that are common to all skupper commands
Types ¶
type DeleteTester ¶
type DeleteTester struct {
// This will ignore the error condition where delete failed because skupper
// was not installed in the first place. It can be used in the situations
// where you just want to make sure skupper is not on the namespace
IgnoreNotInstalled bool
}
DeleteTester allows running and validating `skupper delete`.
func (*DeleteTester) Command ¶
func (d *DeleteTester) Command(cluster *base.ClusterContext) []string
func (*DeleteTester) Run ¶
func (d *DeleteTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
type ErrorHookFunction ¶
type ErrorHookFunction func()
type Expect ¶
type Expect struct {
StdOut []string
StdErr []string
StdOutRe []regexp.Regexp
StdErrRe []regexp.Regexp
StdOutReNot []regexp.Regexp
StdErrReNot []regexp.Regexp
}
A way to verify cli commands output
StdOut and StdErr take a slice of plain strings. It will expect that each string comes after the previous one. In other words, the search for the second string from StdOut starts where the match for the first one finished.
If you want to search for one static string instead, where there is nothing in between each segment, just use a single item with one big string
StdOutRe and StdErrRe take a slice of regular expressions. Those do not have the same restriction on one coming after the other. If you want that behavior with regexes, create a single regex with the two expressions you're looking for.
StdOutReNot and StdErrReNot behave like the previous ones, but ensure that the patters are not there in the checked string
type ExposeTester ¶
type ExposeTester struct {
TargetType string
TargetName string
Address string
Headless bool
Port int
Protocol string
TargetPort int
PolicyProhibits bool
}
ExposeTester runs `skupper expose` and validates service has been exposed accordingly.
func (*ExposeTester) Command ¶
func (e *ExposeTester) Command(cluster *base.ClusterContext) []string
func (*ExposeTester) Run ¶
func (e *ExposeTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
type InitTester ¶
type InitTester struct {
ConsoleAuth string
ConsoleUser string
ConsolePassword string
Ingress string
ConsoleIngress string
RouterDebugMode string
RouterLogging string
RouterMode string
RouterCPU string
RouterMemory string
ControllerCPU string
ControllerMemory string
RouterCPULimit string
RouterMemoryLimit string
ControllerCPULimit string
ControllerMemoryLimit string
SiteName string
EnableConsole bool
EnableFlowCollector bool
RunAsUser string
RunAsGroup string
}
InitTester runs `skupper init` and validates output, console, as well as skupper resources that should be availble in the cluster.
func (*InitTester) Command ¶
func (s *InitTester) Command(cluster *base.ClusterContext) []string
func (*InitTester) Run ¶
func (s *InitTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
func (*InitTester) ValidateConsole ¶
func (s *InitTester) ValidateConsole(cluster *base.ClusterContext) error
func (*InitTester) ValidateConsoleIngress ¶
func (s *InitTester) ValidateConsoleIngress(cluster *base.ClusterContext) error
func (*InitTester) ValidateIngress ¶
func (s *InitTester) ValidateIngress(cluster *base.ClusterContext) error
func (*InitTester) ValidateRouterDebugMode ¶
func (s *InitTester) ValidateRouterDebugMode(cluster *base.ClusterContext) error
func (*InitTester) ValidateRouterLogging ¶
func (s *InitTester) ValidateRouterLogging(cluster *base.ClusterContext) error
type RevokeAccessTester ¶
type RevokeAccessTester struct {
ExpectClaimRecordsDeleted bool
// contains filtered or unexported fields
}
RevokeAccessTester allows running and validating `skupper revoke-access`.
func (*RevokeAccessTester) Command ¶
func (d *RevokeAccessTester) Command(cluster *base.ClusterContext) []string
func (*RevokeAccessTester) Run ¶
func (d *RevokeAccessTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
type SkupperCommandTester ¶
type SkupperCommandTester interface {
// Command returns a slice of strings representing the composed arguments
Command(cluster *base.ClusterContext) []string
// Run executed given command using the skupper binary and validates
// if execution was successful, returning stdout, stderr and error
Run(cluster *base.ClusterContext) (string, string, error)
}
SkupperCommandTester defines an interface for all skupper (binary) commands. The idea is that each command implementation provides a set of Properties to help defining the command line execution and it must be able to run the command and validate the results.
type SkupperTask ¶
type SkupperTask struct {
Ctx *base.ClusterContext
Commands []SkupperCommandTester
}
SkupperTask defines a set of skupper commands (init, status, expose, ...) that will be executed in the given ClusterContext
type StatusTester ¶
type StatusTester struct {
RouterMode string
SiteName string
ConnectedSites int
ConnectedSitesIndirect int
ExposedServices int
ConsoleEnabled bool
CollectorEnabled bool
ConsoleAuthInternal bool
NotEnabled bool
PolicyEnabled *bool
}
StatusTester runs `skupper status` and validates outcome defined attributes. It runs continuously till output matches expected content or until it times out.
func (*StatusTester) Command ¶
func (s *StatusTester) Command(cluster *base.ClusterContext) []string
func (*StatusTester) Run ¶
func (s *StatusTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
type TestScenario ¶
type TestScenario struct {
Name string
Tasks []SkupperTask
// This allows for a function to be configured to be run whenever the
// TestScenario fails. It can be used, for example, for gathering
// additional debug information
ErrorHook ErrorHookFunction
}
TestScenario represents a set of tasks performed using the skupper cli. It helps grouping a set of commands that can be performed against different clusters.
func (*TestScenario) AppendTasks ¶
func (ts *TestScenario) AppendTasks(others ...TestScenario)
Appends the tasks from other TestScenarios to this one. Use this for composing complex scenarios from simpler ones.
type UnexposeTester ¶
UnexposeTester runs `skupper unexpose` and validates outcome and asserts service has been effectively removed
func (*UnexposeTester) Command ¶
func (e *UnexposeTester) Command(cluster *base.ClusterContext) []string
func (*UnexposeTester) Run ¶
func (e *UnexposeTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)
type VersionTester ¶
type VersionTester struct{}
VersionTester runs `skupper version` and validates its output
func (*VersionTester) Command ¶
func (v *VersionTester) Command(cluster *base.ClusterContext) []string
func (*VersionTester) Run ¶
func (v *VersionTester) Run(cluster *base.ClusterContext) (stdout string, stderr string, err error)