Documentation
¶
Index ¶
- Constants
- Variables
- func NewContext() context.Context
- func NewFrontendClient(connection *grpc.ClientConn) workflowservice.WorkflowServiceClient
- func WithDropTask(o *PollAndProcessWorkflowTaskOptions)
- func WithDumpHistory(o *PollAndProcessWorkflowTaskOptions)
- func WithForceNewWorkflowTask(o *PollAndProcessWorkflowTaskOptions)
- func WithNoDumpCommands(o *PollAndProcessWorkflowTaskOptions)
- func WithPollSticky(o *PollAndProcessWorkflowTaskOptions)
- func WithRespondSticky(o *PollAndProcessWorkflowTaskOptions)
- type AdminClient
- type ArchiverBase
- type FrontendClient
- type FunctionalTestBase
- func (s *FunctionalTestBase) DurationNear(value, target, tolerance time.Duration)
- func (s *FunctionalTestBase) EqualHistory(expectedHistory string, actualHistory *historypb.History)
- func (s *FunctionalTestBase) EqualHistoryEvents(expectedHistory string, actualHistoryEvents []*historypb.HistoryEvent)
- type HistoryClient
- type HistoryConfig
- type Option
- type PollAndProcessWorkflowTaskOptionFunc
- type PollAndProcessWorkflowTaskOptions
- type PollAndProcessWorkflowTaskResponse
- type SearchAttributeTestMapper
- type TaskPoller
- func (p *TaskPoller) HandlePartialWorkflowTask(response *workflowservice.PollWorkflowTaskQueueResponse, ...) (*workflowservice.RespondWorkflowTaskCompletedResponse, error)
- func (p *TaskPoller) PollAndProcessActivityTask(dropTask bool) error
- func (p *TaskPoller) PollAndProcessActivityTaskWithID(dropTask bool) error
- func (p *TaskPoller) PollAndProcessWorkflowTask(funcs ...PollAndProcessWorkflowTaskOptionFunc) (res PollAndProcessWorkflowTaskResponse, err error)
- func (p *TaskPoller) PollAndProcessWorkflowTaskWithOptions(opts *PollAndProcessWorkflowTaskOptions) (res PollAndProcessWorkflowTaskResponse, err error)
- type TemporalParams
- type TestCluster
- func (tc *TestCluster) GetAdminClient() AdminClient
- func (tc *TestCluster) GetExecutionManager() persistence.ExecutionManager
- func (tc *TestCluster) GetFrontendClient() FrontendClient
- func (tc *TestCluster) GetHistoryClient() HistoryClient
- func (tc *TestCluster) GetHost() *temporalImpl
- func (tc *TestCluster) GetMatchingClient() matchingservice.MatchingServiceClient
- func (tc *TestCluster) GetOperatorClient() operatorservice.OperatorServiceClient
- func (tc *TestCluster) SetFaultInjectionRate(rate float64)
- func (tc *TestCluster) TearDownCluster() error
- type TestClusterConfig
- type TestClusterParams
- type WorkerConfig
Constants ¶
const NamespaceCacheRefreshInterval = time.Second
Variables ¶
var TestFlags struct { FrontendAddr string FrontendHTTPAddr string PersistenceType string PersistenceDriver string TestClusterConfigFile string PersistenceFaultInjectionRate float64 }
TestFlags contains the feature flags for functional tests
Functions ¶
func NewContext ¶
NewContext create new context with default timeout 90 seconds.
func NewFrontendClient ¶
func NewFrontendClient(connection *grpc.ClientConn) workflowservice.WorkflowServiceClient
NewFrontendClient creates a client to temporal frontend client
func WithDropTask ¶ added in v1.22.1
func WithDropTask(o *PollAndProcessWorkflowTaskOptions)
func WithDumpHistory ¶ added in v1.22.1
func WithDumpHistory(o *PollAndProcessWorkflowTaskOptions)
func WithForceNewWorkflowTask ¶ added in v1.22.1
func WithForceNewWorkflowTask(o *PollAndProcessWorkflowTaskOptions)
func WithNoDumpCommands ¶ added in v1.22.1
func WithNoDumpCommands(o *PollAndProcessWorkflowTaskOptions)
func WithPollSticky ¶ added in v1.22.1
func WithPollSticky(o *PollAndProcessWorkflowTaskOptions)
func WithRespondSticky ¶ added in v1.22.1
func WithRespondSticky(o *PollAndProcessWorkflowTaskOptions)
Types ¶
type AdminClient ¶
type AdminClient interface { adminservice.AdminServiceClient }
AdminClient is the interface exposed by admin service client
func NewAdminClient ¶
func NewAdminClient(connection *grpc.ClientConn) AdminClient
NewAdminClient creates a client to temporal admin client
type ArchiverBase ¶
type ArchiverBase struct {
// contains filtered or unexported fields
}
ArchiverBase is a base struct for archiver provider being used in functional tests
type FrontendClient ¶
type FrontendClient interface { workflowservice.WorkflowServiceClient }
FrontendClient is the interface exposed by frontend service client
type FunctionalTestBase ¶ added in v1.23.0
type FunctionalTestBase struct { suite.Suite Logger log.Logger // contains filtered or unexported fields }
FunctionalTestBase is a base struct for functional tests
func (*FunctionalTestBase) DurationNear ¶ added in v1.23.0
func (s *FunctionalTestBase) DurationNear(value, target, tolerance time.Duration)
func (*FunctionalTestBase) EqualHistory ¶ added in v1.23.0
func (s *FunctionalTestBase) EqualHistory(expectedHistory string, actualHistory *historypb.History)
func (*FunctionalTestBase) EqualHistoryEvents ¶ added in v1.23.0
func (s *FunctionalTestBase) EqualHistoryEvents(expectedHistory string, actualHistoryEvents []*historypb.HistoryEvent)
type HistoryClient ¶
type HistoryClient interface { historyservice.HistoryServiceClient }
HistoryClient is the interface exposed by history service client
func NewHistoryClient ¶
func NewHistoryClient(connection *grpc.ClientConn) HistoryClient
NewHistoryClient creates a client to temporal history service client
type HistoryConfig ¶
type HistoryConfig struct { NumHistoryShards int32 NumHistoryHosts int HistoryCountLimitError int HistoryCountLimitWarn int HistorySizeLimitError int HistorySizeLimitWarn int BlobSizeLimitError int BlobSizeLimitWarn int MutableStateSizeLimitError int MutableStateSizeLimitWarn int }
HistoryConfig contains configs for history service
type Option ¶ added in v1.23.0
type Option func(params *TestClusterParams)
func WithFxOptionsForService ¶ added in v1.23.0
func WithFxOptionsForService(serviceName primitives.ServiceName, options ...fx.Option) Option
WithFxOptionsForService returns an Option which, when passed as an argument to setupSuite, will append the given list of fx options to the end of the arguments to the fx.New call for the given service. For example, if you want to obtain the shard controller for the history service, you can do this:
var shardController shard.Controller s.setupSuite(t, tests.WithFxOptionsForService(primitives.HistoryService, fx.Populate(&shardController))) // now you can use shardController during your test
This is similar to the pattern of plumbing dependencies through the TestClusterConfig, but it's much more convenient, scalable and flexible. The reason we need to do this on a per-service basis is that there are separate fx apps for each one.
type PollAndProcessWorkflowTaskOptionFunc ¶ added in v1.22.1
type PollAndProcessWorkflowTaskOptionFunc func(*PollAndProcessWorkflowTaskOptions)
func WithExpectedAttemptCount ¶ added in v1.22.1
func WithExpectedAttemptCount(c int) PollAndProcessWorkflowTaskOptionFunc
func WithQueryResult ¶ added in v1.22.1
func WithQueryResult(r *querypb.WorkflowQueryResult) PollAndProcessWorkflowTaskOptionFunc
func WithRetries ¶ added in v1.22.1
func WithRetries(c int) PollAndProcessWorkflowTaskOptionFunc
type PollAndProcessWorkflowTaskOptions ¶ added in v1.22.1
type PollAndProcessWorkflowTaskResponse ¶ added in v1.22.1
type PollAndProcessWorkflowTaskResponse struct { IsQueryTask bool NewTask *workflowservice.RespondWorkflowTaskCompletedResponse }
type SearchAttributeTestMapper ¶
type SearchAttributeTestMapper struct{}
func NewSearchAttributeTestMapper ¶
func NewSearchAttributeTestMapper() *SearchAttributeTestMapper
func (*SearchAttributeTestMapper) GetAlias ¶
func (t *SearchAttributeTestMapper) GetAlias(fieldName string, namespace string) (string, error)
func (*SearchAttributeTestMapper) GetFieldName ¶
func (t *SearchAttributeTestMapper) GetFieldName(alias string, namespace string) (string, error)
type TaskPoller ¶
type TaskPoller struct { Engine FrontendClient Namespace string TaskQueue *taskqueuepb.TaskQueue StickyTaskQueue *taskqueuepb.TaskQueue StickyScheduleToStartTimeout time.Duration Identity string WorkflowTaskHandler workflowTaskHandler ActivityTaskHandler activityTaskHandler QueryHandler queryHandler MessageHandler messageHandler Logger log.Logger T *testing.T }
TaskPoller is used in functional tests to poll workflow or activity task queues.
func (*TaskPoller) HandlePartialWorkflowTask ¶
func (p *TaskPoller) HandlePartialWorkflowTask(response *workflowservice.PollWorkflowTaskQueueResponse, forceCreateNewWorkflowTask bool) (*workflowservice.RespondWorkflowTaskCompletedResponse, error)
HandlePartialWorkflowTask for workflow task
func (*TaskPoller) PollAndProcessActivityTask ¶
func (p *TaskPoller) PollAndProcessActivityTask(dropTask bool) error
PollAndProcessActivityTask for activity tasks
func (*TaskPoller) PollAndProcessActivityTaskWithID ¶
func (p *TaskPoller) PollAndProcessActivityTaskWithID(dropTask bool) error
PollAndProcessActivityTaskWithID is similar to PollAndProcessActivityTask but using RespondActivityTask...ByID
func (*TaskPoller) PollAndProcessWorkflowTask ¶
func (p *TaskPoller) PollAndProcessWorkflowTask(funcs ...PollAndProcessWorkflowTaskOptionFunc) (res PollAndProcessWorkflowTaskResponse, err error)
func (*TaskPoller) PollAndProcessWorkflowTaskWithOptions ¶ added in v1.22.1
func (p *TaskPoller) PollAndProcessWorkflowTaskWithOptions(opts *PollAndProcessWorkflowTaskOptions) (res PollAndProcessWorkflowTaskResponse, err error)
type TemporalParams ¶
type TemporalParams struct { ClusterMetadataConfig *cluster.Config PersistenceConfig config.Persistence MetadataMgr persistence.MetadataManager ClusterMetadataManager persistence.ClusterMetadataManager ShardMgr persistence.ShardManager ExecutionManager persistence.ExecutionManager TaskMgr persistence.TaskManager NamespaceReplicationQueue persistence.NamespaceReplicationQueue Logger log.Logger ClusterNo int ArchiverMetadata carchiver.ArchivalMetadata ArchiverProvider provider.ArchiverProvider EnableReadHistoryFromArchival bool HistoryConfig *HistoryConfig ESConfig *esclient.Config ESClient esclient.Client WorkerConfig *WorkerConfig MockAdminClient map[string]adminservice.AdminServiceClient NamespaceReplicationTaskExecutor namespace.ReplicationTaskExecutor SpanExporters []otelsdktrace.SpanExporter DynamicConfigOverrides map[dynamicconfig.Key]interface{} TLSConfigProvider *encryption.FixedTLSConfigProvider CaptureMetricsHandler *metricstest.CaptureHandler // ServiceFxOptions is populated by WithFxOptionsForService. ServiceFxOptions map[primitives.ServiceName][]fx.Option TaskCategoryRegistry tasks.TaskCategoryRegistry }
TemporalParams contains everything needed to bootstrap Temporal
type TestCluster ¶
type TestCluster struct {
// contains filtered or unexported fields
}
TestCluster is a base struct for functional tests
func NewCluster ¶
func NewCluster(t *testing.T, options *TestClusterConfig, logger log.Logger) (*TestCluster, error)
NewCluster creates and sets up the test cluster
func (*TestCluster) GetAdminClient ¶
func (tc *TestCluster) GetAdminClient() AdminClient
GetAdminClient returns an admin client from the test cluster
func (*TestCluster) GetExecutionManager ¶
func (tc *TestCluster) GetExecutionManager() persistence.ExecutionManager
GetExecutionManager returns an execution manager factory from the test cluster
func (*TestCluster) GetFrontendClient ¶
func (tc *TestCluster) GetFrontendClient() FrontendClient
GetFrontendClient returns a frontend client from the test cluster
func (*TestCluster) GetHistoryClient ¶
func (tc *TestCluster) GetHistoryClient() HistoryClient
GetHistoryClient returns a history client from the test cluster
func (*TestCluster) GetHost ¶
func (tc *TestCluster) GetHost() *temporalImpl
func (*TestCluster) GetMatchingClient ¶ added in v1.21.0
func (tc *TestCluster) GetMatchingClient() matchingservice.MatchingServiceClient
GetMatchingClient returns a matching client from the test cluster
func (*TestCluster) GetOperatorClient ¶
func (tc *TestCluster) GetOperatorClient() operatorservice.OperatorServiceClient
func (*TestCluster) SetFaultInjectionRate ¶
func (tc *TestCluster) SetFaultInjectionRate(rate float64)
func (*TestCluster) TearDownCluster ¶
func (tc *TestCluster) TearDownCluster() error
TearDownCluster tears down the test cluster
type TestClusterConfig ¶
type TestClusterConfig struct { FrontendAddress string EnableArchival bool IsMasterCluster bool ClusterNo int ClusterMetadata cluster.Config Persistence persistencetests.TestBaseOptions HistoryConfig *HistoryConfig ESConfig *esclient.Config WorkerConfig *WorkerConfig MockAdminClient map[string]adminservice.AdminServiceClient FaultInjection config.FaultInjection `yaml:"faultinjection"` DynamicConfigOverrides map[dynamicconfig.Key]interface{} GenerateMTLS bool EnableMetricsCapture bool // ServiceFxOptions can be populated using WithFxOptionsForService. ServiceFxOptions map[primitives.ServiceName][]fx.Option }
TestClusterConfig are config for a test cluster
func GetTestClusterConfig ¶
func GetTestClusterConfig(configFile string) (*TestClusterConfig, error)
GetTestClusterConfig return test cluster config
type TestClusterParams ¶ added in v1.23.0
type TestClusterParams struct {
ServiceOptions map[primitives.ServiceName][]fx.Option
}
TestClusterParams contains the variables which are used to configure test suites via the Option type.
func ApplyTestClusterParams ¶ added in v1.23.0
func ApplyTestClusterParams(options []Option) TestClusterParams
type WorkerConfig ¶
WorkerConfig is the config for enabling/disabling Temporal worker