Documentation ¶
Index ¶
- Constants
- func GetScenarios() map[string]*Scenario
- func MustRegisterScenario(scenario Scenario)
- func TaskQueueForRun(scenarioName, runID string) string
- func VisibilityCountIsEventually(ctx context.Context, client client.Client, ...) error
- type Executor
- type ExecutorFunc
- type FileOrArgs
- type FuzzExecutor
- type GenericExecutor
- type HasDefaultConfiguration
- type KitchenSinkExecutor
- type KitchenSinkWorkflowOptions
- type Run
- func (r *Run) DefaultKitchenSinkWorkflowOptions() KitchenSinkWorkflowOptions
- func (r *Run) DefaultStartWorkflowOptions() client.StartWorkflowOptions
- func (r *Run) ExecuteAnyWorkflow(ctx context.Context, options client.StartWorkflowOptions, workflow interface{}, ...) error
- func (r *Run) ExecuteKitchenSinkWorkflow(ctx context.Context, options *KitchenSinkWorkflowOptions) error
- func (r *Run) TaskQueue() string
- type RunConfiguration
- type Scenario
- type ScenarioInfo
Constants ¶
const DefaultIterations = 10
const DefaultMaxConcurrent = 10
Variables ¶
This section is empty.
Functions ¶
func GetScenarios ¶
GetScenarios gets a copy of registered scenarios
func MustRegisterScenario ¶
func MustRegisterScenario(scenario Scenario)
MustRegisterScenario registers a scenario in the global static registry. Panics if registration fails. The file name of the caller is be used as the scenario name.
func TaskQueueForRun ¶
TaskQueueForRun returns a default task queue name for the given scenario name and run ID.
func VisibilityCountIsEventually ¶
func VisibilityCountIsEventually( ctx context.Context, client client.Client, request *workflowservice.CountWorkflowExecutionsRequest, expectedCount int, waitAtMost time.Duration, ) error
VisibilityCountIsEventually ensures that some visibility query count matches the provided expected number within the provided time limit.
Types ¶
type Executor ¶
type Executor interface { // Run the scenario Run(context.Context, ScenarioInfo) error }
Executor for a scenario.
type ExecutorFunc ¶
type ExecutorFunc func(context.Context, ScenarioInfo) error
ExecutorFunc is an Executor implementation for a function
func (ExecutorFunc) Run ¶
func (e ExecutorFunc) Run(ctx context.Context, info ScenarioInfo) error
Run implements [Executor.Run].
type FileOrArgs ¶
type FuzzExecutor ¶
type FuzzExecutor struct { // Must be specified, called once on startup, and determines how TestInputs will be used for // iterations of the scenario. If a file is specified, it will be loaded and used as the input // for every iteration. If generator args are specified, it will be invoked once per iteration // and those inputs will be saved and then fed out to each iteration. InitInputs func(context.Context, ScenarioInfo) FileOrArgs DefaultConfiguration RunConfiguration }
func (FuzzExecutor) GetDefaultConfiguration ¶
func (k FuzzExecutor) GetDefaultConfiguration() RunConfiguration
func (FuzzExecutor) Run ¶
func (k FuzzExecutor) Run(ctx context.Context, info ScenarioInfo) error
type GenericExecutor ¶
type GenericExecutor struct { // Function to execute a single iteration of this scenario Execute func(context.Context, *Run) error // Default configuration if any. DefaultConfiguration RunConfiguration }
func (*GenericExecutor) GetDefaultConfiguration ¶
func (g *GenericExecutor) GetDefaultConfiguration() RunConfiguration
func (*GenericExecutor) Run ¶
func (g *GenericExecutor) Run(ctx context.Context, info ScenarioInfo) error
type HasDefaultConfiguration ¶
type HasDefaultConfiguration interface {
GetDefaultConfiguration() RunConfiguration
}
HasDefaultConfiguration is an interface executors can implement to show their default configuration.
type KitchenSinkExecutor ¶
type KitchenSinkExecutor struct { TestInput *kitchensink.TestInput // Called once on start PrepareTestInput func(context.Context, ScenarioInfo, *kitchensink.TestInput) error // Called for each iteration. TestInput is copied entirely into KitchenSinkWorkflowOptions on // each iteration. UpdateWorkflowOptions func(context.Context, *Run, *KitchenSinkWorkflowOptions) error DefaultConfiguration RunConfiguration }
func (KitchenSinkExecutor) GetDefaultConfiguration ¶
func (k KitchenSinkExecutor) GetDefaultConfiguration() RunConfiguration
func (KitchenSinkExecutor) Run ¶
func (k KitchenSinkExecutor) Run(ctx context.Context, info ScenarioInfo) error
type KitchenSinkWorkflowOptions ¶
type KitchenSinkWorkflowOptions struct { Params *kitchensink.TestInput StartOptions client.StartWorkflowOptions }
type Run ¶
type Run struct { // Do not mutate this, this is shared across the entire scenario *ScenarioInfo // Each run should have a unique iteration. Iteration int Logger *zap.SugaredLogger }
Run represents an individual scenario run (many may be in a single instance (of possibly many) of a scenario).
func (*Run) DefaultKitchenSinkWorkflowOptions ¶
func (r *Run) DefaultKitchenSinkWorkflowOptions() KitchenSinkWorkflowOptions
DefaultKitchenSinkWorkflowOptions gets the default kitchen sink workflow info.
func (*Run) DefaultStartWorkflowOptions ¶
func (r *Run) DefaultStartWorkflowOptions() client.StartWorkflowOptions
DefaultStartWorkflowOptions gets default start workflow info.
func (*Run) ExecuteAnyWorkflow ¶
func (r *Run) ExecuteAnyWorkflow(ctx context.Context, options client.StartWorkflowOptions, workflow interface{}, valuePtr interface{}, args ...interface{}) error
ExecuteAnyWorkflow wraps calls to the client executing workflows to include some logging, returning an error if the execution fails.
func (*Run) ExecuteKitchenSinkWorkflow ¶
func (r *Run) ExecuteKitchenSinkWorkflow(ctx context.Context, options *KitchenSinkWorkflowOptions) error
ExecuteKitchenSinkWorkflow starts the generic "kitchen sink" workflow and waits for its completion ignoring its result. Concurrently it will perform any client actions specified in kitchensink.TestInput.ClientSequence
type RunConfiguration ¶
type RunConfiguration struct { // Number of iterations to run of this scenario (mutually exclusive with Duration). Iterations int // Duration limit of this scenario (mutually exclusive with Iterations). If neither iterations // nor duration is set, default is DefaultIterations. When the Duration is elapsed, no new // iterations will be started, but we will wait for any currently running iterations to // complete. Duration time.Duration // Maximum number of instances of the Execute method to run concurrently. // Default is DefaultMaxConcurrent. MaxConcurrent int // Timeout is the maximum amount of time we'll wait for the scenario to finish running. // If the timeout is hit any pending executions will be cancelled and the scenario will exit // with an error. The default is unlimited. Timeout time.Duration // Do not register the default search attributes used by scenarios. If the SAs are not registered // by the run, they must be registered by some other method. This is needed because cloud cells // cannot use the SDK to register SAs, instead the SAs must be registered through the control plane. // Default is false. DoNotRegisterSearchAttributes bool }
func (*RunConfiguration) ApplyDefaults ¶
func (r *RunConfiguration) ApplyDefaults()
type Scenario ¶
func GetScenario ¶
GetScenario gets a scenario by name from the global static registry.
type ScenarioInfo ¶
type ScenarioInfo struct { // Name of the scenario (inferred from the file name) ScenarioName string // Run ID of the current scenario run, used to generate a unique task queue // and workflow ID prefix. This is a single value for the whole scenario, and // not a Workflow RunId. RunID string // Metrics component for registering new metrics. MetricsHandler client.MetricsHandler // A zap logger. Logger *zap.SugaredLogger // A Temporal client. Client client.Client // Configuration info passed by user if any. Configuration RunConfiguration // ScenarioOptions are info passed from the command line. Do not mutate these. ScenarioOptions map[string]string // The namespace that was used when connecting the client. Namespace string // Path to the root of the omes dir RootPath string }
ScenarioInfo contains information about the scenario under execution.
func (*ScenarioInfo) NewRun ¶
func (s *ScenarioInfo) NewRun(iteration int) *Run
NewRun creates a new run.
func (*ScenarioInfo) RegisterDefaultSearchAttributes ¶
func (s *ScenarioInfo) RegisterDefaultSearchAttributes(ctx context.Context) error
func (*ScenarioInfo) ScenarioOptionBool ¶
func (s *ScenarioInfo) ScenarioOptionBool(name string, defaultValue bool) bool
func (*ScenarioInfo) ScenarioOptionInt ¶
func (s *ScenarioInfo) ScenarioOptionInt(name string, defaultValue int) int