host

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2022 License: MIT Imports: 75 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestFlags struct {
	FrontendAddr                  string
	PersistenceType               string
	PersistenceDriver             string
	TestClusterConfigFile         string
	PersistenceFaultInjectionRate float64
}

TestFlags contains the feature flags for integration tests

Functions

func CreateESClient added in v0.5.9

func CreateESClient(s suite.Suite, config *esclient.Config, logger log.Logger) esclient.IntegrationTestsClient

CreateESClient create ElasticSearch client for test

func CreateIndex added in v0.5.9

func CreateIndex(s suite.Suite, esClient esclient.IntegrationTestsClient, indexName string)

CreateIndex create test index

func DeleteIndex added in v0.5.9

func DeleteIndex(s suite.Suite, esClient esclient.IntegrationTestsClient, indexName string)

DeleteIndex delete test index

func NewContext added in v0.27.0

func NewContext() context.Context

NewContext create new context with default timeout 90 seconds.

func NewFrontendClient added in v0.5.0

func NewFrontendClient(connection *grpc.ClientConn) workflowservice.WorkflowServiceClient

NewFrontendClient creates a client to temporal frontend client

func NewTemporal added in v0.27.0

func NewTemporal(params *TemporalParams) *temporalImpl

NewTemporal returns an instance that hosts full temporal in one process

func PutIndexTemplate added in v0.5.9

func PutIndexTemplate(s suite.Suite, esClient esclient.IntegrationTestsClient, templateConfigFile, templateName string)

PutIndexTemplate put index template for test

Types

type AdminClient added in v0.5.0

type AdminClient interface {
	adminservice.AdminServiceClient
}

AdminClient is the interface exposed by admin service client

func NewAdminClient added in v0.5.0

func NewAdminClient(connection *grpc.ClientConn) AdminClient

NewAdminClient creates a client to temporal admin client

type ArchiverBase added in v0.7.0

type ArchiverBase struct {
	// contains filtered or unexported fields
}

ArchiverBase is a base struct for archiver provider being used in integration tests

type FrontendClient added in v0.5.0

type FrontendClient interface {
	workflowservice.WorkflowServiceClient
}

FrontendClient is the interface exposed by frontend service client

type HistoryClient added in v0.27.0

type HistoryClient interface {
	historyservice.HistoryServiceClient
}

HistoryClient is the interface exposed by history service client

func NewHistoryClient added in v0.27.0

func NewHistoryClient(connection *grpc.ClientConn) HistoryClient

NewHistoryClient creates a client to temporal history service client

type HistoryConfig added in v0.5.7

type HistoryConfig struct {
	NumHistoryShards       int32
	NumHistoryHosts        int
	HistoryCountLimitError int
	HistoryCountLimitWarn  int
}

HistoryConfig contains configs for history service

type IntegrationBase added in v0.4.0

type IntegrationBase struct {
	suite.Suite

	Logger log.Logger
	// contains filtered or unexported fields
}

IntegrationBase is a base struct for integration tests

func (*IntegrationBase) DurationNear added in v1.15.0

func (s *IntegrationBase) DurationNear(value, target, tolerance time.Duration)

type SearchAttributeTestMapper added in v1.13.4

type SearchAttributeTestMapper struct{}

func NewSearchAttributeTestMapper added in v1.13.4

func NewSearchAttributeTestMapper() *SearchAttributeTestMapper

func (*SearchAttributeTestMapper) GetAlias added in v1.13.4

func (t *SearchAttributeTestMapper) GetAlias(fieldName string, namespace string) (string, error)

func (*SearchAttributeTestMapper) GetFieldName added in v1.13.4

func (t *SearchAttributeTestMapper) GetFieldName(alias string, namespace string) (string, error)

type TaskPoller added in v0.4.0

type TaskPoller struct {
	Engine                       FrontendClient
	Namespace                    string
	TaskQueue                    *taskqueuepb.TaskQueue
	StickyTaskQueue              *taskqueuepb.TaskQueue
	StickyScheduleToStartTimeout time.Duration
	Identity                     string
	WorkflowTaskHandler          workflowTaskHandler
	ActivityTaskHandler          activityTaskHandler
	QueryHandler                 queryHandler
	Logger                       log.Logger
	T                            *testing.T
}

TaskPoller is used in integration tests to poll workflow or activity task queues.

func (*TaskPoller) HandlePartialWorkflowTask added in v0.27.0

func (p *TaskPoller) HandlePartialWorkflowTask(response *workflowservice.PollWorkflowTaskQueueResponse) (
	*workflowservice.RespondWorkflowTaskCompletedResponse, error)

HandlePartialWorkflowTask for workflow task

func (*TaskPoller) PollAndProcessActivityTask added in v0.4.0

func (p *TaskPoller) PollAndProcessActivityTask(dropTask bool) error

PollAndProcessActivityTask for activity tasks

func (*TaskPoller) PollAndProcessActivityTaskWithID added in v0.4.0

func (p *TaskPoller) PollAndProcessActivityTaskWithID(dropTask bool) error

PollAndProcessActivityTaskWithID is similar to PollAndProcessActivityTask but using RespondActivityTask...ByID

func (*TaskPoller) PollAndProcessWorkflowTask added in v0.27.0

func (p *TaskPoller) PollAndProcessWorkflowTask(dumpHistory bool, dropTask bool) (isQueryTask bool, err error)

PollAndProcessWorkflowTask for workflow tasks

func (*TaskPoller) PollAndProcessWorkflowTaskWithAttempt added in v0.27.0

func (p *TaskPoller) PollAndProcessWorkflowTaskWithAttempt(
	dumpHistory bool,
	dropTask bool,
	pollStickyTaskQueue bool,
	respondStickyTaskQueue bool,
	workflowTaskAttempt int32,
) (isQueryTask bool, err error)

PollAndProcessWorkflowTaskWithAttempt for workflow tasks

func (*TaskPoller) PollAndProcessWorkflowTaskWithAttemptAndRetry added in v0.27.0

func (p *TaskPoller) PollAndProcessWorkflowTaskWithAttemptAndRetry(
	dumpHistory bool,
	dropTask bool,
	pollStickyTaskQueue bool,
	respondStickyTaskQueue bool,
	workflowTaskAttempt int32,
	retryCount int,
) (isQueryTask bool, err error)

PollAndProcessWorkflowTaskWithAttemptAndRetry for workflow tasks

func (*TaskPoller) PollAndProcessWorkflowTaskWithAttemptAndRetryAndForceNewWorkflowTask added in v0.27.0

func (p *TaskPoller) PollAndProcessWorkflowTaskWithAttemptAndRetryAndForceNewWorkflowTask(
	dumpHistory bool,
	dropTask bool,
	pollStickyTaskQueue bool,
	respondStickyTaskQueue bool,
	workflowTaskAttempt int32,
	retryCount int,
	forceCreateNewWorkflowTask bool,
	queryResult *querypb.WorkflowQueryResult,
) (isQueryTask bool, newTask *workflowservice.RespondWorkflowTaskCompletedResponse, err error)

PollAndProcessWorkflowTaskWithAttemptAndRetryAndForceNewWorkflowTask for workflow tasks

func (*TaskPoller) PollAndProcessWorkflowTaskWithSticky added in v0.27.0

func (p *TaskPoller) PollAndProcessWorkflowTaskWithSticky(dumpHistory bool, dropTask bool) (isQueryTask bool, err error)

PollAndProcessWorkflowTaskWithSticky for workflow tasks

func (*TaskPoller) PollAndProcessWorkflowTaskWithoutRetry added in v0.27.0

func (p *TaskPoller) PollAndProcessWorkflowTaskWithoutRetry(dumpHistory bool, dropTask bool) (isQueryTask bool, err error)

PollAndProcessWorkflowTaskWithoutRetry for workflow tasks

type Temporal added in v0.27.0

type Temporal interface {
	Start() error
	Stop()
	GetAdminClient() adminservice.AdminServiceClient
	GetFrontendClient() workflowservice.WorkflowServiceClient
	GetHistoryClient() historyservice.HistoryServiceClient
	GetExecutionManager() persistence.ExecutionManager
	RefreshNamespaceCache()
}

Temporal hosts all of temporal services in one process

type TemporalParams added in v0.27.0

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
}

TemporalParams contains everything needed to bootstrap Temporal

type TestCluster added in v0.5.7

type TestCluster struct {
	// contains filtered or unexported fields
}

TestCluster is a base struct for integration tests

func NewCluster added in v0.5.7

func NewCluster(options *TestClusterConfig, logger log.Logger) (*TestCluster, error)

NewCluster creates and sets up the test cluster

func (*TestCluster) GetAdminClient added in v0.5.7

func (tc *TestCluster) GetAdminClient() AdminClient

GetAdminClient returns an admin client from the test cluster

func (*TestCluster) GetExecutionManager added in v1.12.0

func (tc *TestCluster) GetExecutionManager() persistence.ExecutionManager

GetExecutionManager returns an execution manager factory from the test cluster

func (*TestCluster) GetFrontendClient added in v0.5.7

func (tc *TestCluster) GetFrontendClient() FrontendClient

GetFrontendClient returns a frontend client from the test cluster

func (*TestCluster) GetHistoryClient added in v0.27.0

func (tc *TestCluster) GetHistoryClient() HistoryClient

GetHistoryClient returns a history client from the test cluster

func (*TestCluster) GetHost added in v1.14.0

func (tc *TestCluster) GetHost() *temporalImpl

func (*TestCluster) RefreshNamespaceCache added in v1.13.0

func (tc *TestCluster) RefreshNamespaceCache()

func (*TestCluster) SetFaultInjectionRate added in v1.13.0

func (tc *TestCluster) SetFaultInjectionRate(rate float64)

func (*TestCluster) TearDownCluster added in v0.5.7

func (tc *TestCluster) TearDownCluster()

TearDownCluster tears down the test cluster

type TestClusterConfig added in v0.5.7

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"`
}

TestClusterConfig are config for a test cluster

func GetTestClusterConfig added in v0.5.7

func GetTestClusterConfig(configFile string) (*TestClusterConfig, error)

GetTestClusterConfig return test cluster config

type WorkerConfig added in v0.5.7

type WorkerConfig struct {
	EnableArchiver   bool
	EnableIndexer    bool
	EnableReplicator bool
}

WorkerConfig is the config for enabling/disabling Temporal worker

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL