host

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 73 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestFlags struct {
	FrontendAddr          string
	FrontendAddrGRPC      string
	PersistenceType       string
	SQLPluginName         string
	TestClusterConfigFile string
}

TestFlags contains the feature flags for integration tests

Functions

func CreateESClient added in v0.5.9

func CreateESClient(s suite.Suite, url string) *elastic.Client

CreateESClient create ElasticSearch client for test

func CreateIndex added in v0.5.9

func CreateIndex(s suite.Suite, esClient *elastic.Client, indexName string)

CreateIndex create test index

func DeleteIndex added in v0.5.9

func DeleteIndex(s suite.Suite, esClient *elastic.Client, 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 PutIndexTemplate added in v0.5.9

func PutIndexTemplate(s suite.Suite, esClient *elastic.Client, 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       int
	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

type MessagingClientConfig added in v0.5.7

type MessagingClientConfig struct {
	UseMock     bool
	KafkaConfig *messaging.KafkaConfig
}

MessagingClientConfig is the config for messaging config

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
	GetExecutionManagerFactory() persistence.ExecutionManagerFactory
}

Temporal hosts all of temporal services in one process

func NewTemporal added in v0.27.0

func NewTemporal(params *TemporalParams) Temporal

NewTemporal returns an instance that hosts full temporal in one process

type TemporalParams added in v0.27.0

type TemporalParams struct {
	ClusterMetadata                  cluster.Metadata
	PersistenceConfig                config.Persistence
	MessagingClient                  messaging.Client
	MetadataMgr                      persistence.MetadataManager
	ShardMgr                         persistence.ShardManager
	HistoryV2Mgr                     persistence.HistoryManager
	ExecutionMgrFactory              persistence.ExecutionManagerFactory
	TaskMgr                          persistence.TaskManager
	VisibilityMgr                    persistence.VisibilityManager
	NamespaceReplicationQueue        persistence.NamespaceReplicationQueue
	Logger                           log.Logger
	ClusterNo                        int
	ArchiverMetadata                 carchiver.ArchivalMetadata
	ArchiverProvider                 provider.ArchiverProvider
	EnableReadHistoryFromArchival    bool
	HistoryConfig                    *HistoryConfig
	ESConfig                         *elasticsearch.Config
	ESClient                         elasticsearch.Client
	WorkerConfig                     *WorkerConfig
	MockAdminClient                  map[string]adminClient.Client
	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) GetExecutionManagerFactory added in v0.27.0

func (tc *TestCluster) GetExecutionManagerFactory() persistence.ExecutionManagerFactory

GetExecutionManagerFactory 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) 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       config.ClusterMetadata
	MessagingClientConfig *MessagingClientConfig
	Persistence           persistencetests.TestBaseOptions
	HistoryConfig         *HistoryConfig
	ESConfig              *elasticsearch.Config
	WorkerConfig          *WorkerConfig
	MockAdminClient       map[string]adminClient.Client
}

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