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(platform types.Platform, cluster *base.ClusterContext) []string
- type CommandVerifier
- type DeleteTester
- type ErrorHookFunction
- type Expect
- type ExposeTester
- type InitTester
- func (s *InitTester) Command(platform types.Platform, cluster *base.ClusterContext) []string
- func (s *InitTester) Run(platform types.Platform, cluster *base.ClusterContext) (stdout string, stderr string, err error)
- func (s *InitTester) ValidateConsoleIngress(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateConsoleKube(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateConsolePodman(site *podman.Site) error
- func (s *InitTester) ValidateIngress(cluster *base.ClusterContext) error
- func (s *InitTester) ValidateKubernetes(cluster *base.ClusterContext, stdout, stderr string) (err error)
- func (s *InitTester) ValidatePodman(stdout string, stderr string) (err error)
- func (s *InitTester) ValidateRouterLogging(cluster *base.ClusterContext) error
- type PodmanExposeOptions
- type PodmanInitOptions
- 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(platform types.Platform, cluster *base.ClusterContext) []string
SkupperCommonOptions returns a list of all options that are common to all skupper commands
Types ¶
type CommandVerifier ¶
CommandVerifier used as a pre or post command hook. They don't need to be tied to a skupper CLI execution, but can be used before or after a skupper CLI execution as part of a skupper task.
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(platform types.Platform, cluster *base.ClusterContext) []string
func (*DeleteTester) Run ¶
func (d *DeleteTester) Run(platform types.Platform, 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 patterns 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 Podman PodmanExposeOptions }
ExposeTester runs `skupper expose` and validates service has been exposed accordingly.
func (*ExposeTester) Command ¶
func (e *ExposeTester) Command(platform types.Platform, cluster *base.ClusterContext) []string
func (*ExposeTester) Run ¶
func (e *ExposeTester) Run(platform types.Platform, cluster *base.ClusterContext) (stdout string, stderr string, err error)
type InitTester ¶
type InitTester struct { ConsoleAuth string ConsoleUser string ConsolePassword string Ingress string ConsoleIngress 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 Podman PodmanInitOptions }
InitTester runs `skupper init` and validates output, console, as well as skupper resources that should be available in the cluster.
func (*InitTester) Command ¶
func (s *InitTester) Command(platform types.Platform, cluster *base.ClusterContext) []string
func (*InitTester) Run ¶
func (s *InitTester) Run(platform types.Platform, cluster *base.ClusterContext) (stdout string, stderr string, err error)
func (*InitTester) ValidateConsoleIngress ¶
func (s *InitTester) ValidateConsoleIngress(cluster *base.ClusterContext) error
func (*InitTester) ValidateConsoleKube ¶
func (s *InitTester) ValidateConsoleKube(cluster *base.ClusterContext) error
func (*InitTester) ValidateConsolePodman ¶
func (s *InitTester) ValidateConsolePodman(site *podman.Site) error
func (*InitTester) ValidateIngress ¶
func (s *InitTester) ValidateIngress(cluster *base.ClusterContext) error
func (*InitTester) ValidateKubernetes ¶
func (s *InitTester) ValidateKubernetes(cluster *base.ClusterContext, stdout, stderr string) (err error)
func (*InitTester) ValidatePodman ¶
func (s *InitTester) ValidatePodman(stdout string, stderr string) (err error)
func (*InitTester) ValidateRouterLogging ¶
func (s *InitTester) ValidateRouterLogging(cluster *base.ClusterContext) error
type PodmanExposeOptions ¶
type PodmanInitOptions ¶
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(platform types.Platform, cluster *base.ClusterContext) []string
func (*RevokeAccessTester) Run ¶
func (d *RevokeAccessTester) Run(platform types.Platform, 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(platform types.Platform, cluster *base.ClusterContext) []string // Run executed given command using the skupper binary and validates // if execution was successful, returning stdout, stderr and error Run(platform types.Platform, 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 { Platform types.Platform Ctx *base.ClusterContext PreVerifiers []CommandVerifier Commands []SkupperCommandTester PostVerifiers []CommandVerifier }
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(platform types.Platform, cluster *base.ClusterContext) []string
func (*StatusTester) Run ¶
func (s *StatusTester) Run(platform types.Platform, 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(platform types.Platform, cluster *base.ClusterContext) []string
func (*UnexposeTester) Run ¶
func (e *UnexposeTester) Run(platform types.Platform, 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(platform types.Platform, cluster *base.ClusterContext) []string
func (*VersionTester) Run ¶
func (v *VersionTester) Run(platform types.Platform, cluster *base.ClusterContext) (stdout string, stderr string, err error)