Skip to content

Commit

Permalink
Integration tests for history archival (cadence-workflow#1550)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 authored Mar 19, 2019
1 parent 5b516bd commit 50423a0
Show file tree
Hide file tree
Showing 17 changed files with 579 additions and 108 deletions.
4 changes: 2 additions & 2 deletions .gen/go/shared/idl.go

Large diffs are not rendered by default.

43 changes: 41 additions & 2 deletions .gen/go/shared/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions common/cluster/metadataTestBase.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ var (
)

// GetTestClusterMetadata return an cluster metadata instance, which is initialized
func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool) Metadata {
func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool, enableArchival bool) Metadata {
masterClusterName := TestCurrentClusterName
if !isMasterCluster {
masterClusterName = TestAlternativeClusterName
}

archivalStatus := "disabled"
clusterDefaultBucket := ""
if enableArchival {
archivalStatus = "enabled"
clusterDefaultBucket = "default_bucket"
}
if enableGlobalDomain {
return NewMetadata(
bark.NewNopLogger(),
Expand All @@ -88,8 +94,8 @@ func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool) Metad
TestCurrentClusterName,
TestAllClusterFailoverVersions,
TestAllClusterAddress,
dynamicconfig.GetStringPropertyFn("disabled"),
"",
dynamicconfig.GetStringPropertyFn(archivalStatus),
clusterDefaultBucket,
)
}

Expand All @@ -102,7 +108,7 @@ func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool) Metad
TestCurrentClusterName,
TestSingleDCAllClusterFailoverVersions,
TestSingleDCAllClusterAddress,
dynamicconfig.GetStringPropertyFn("disabled"),
"",
dynamicconfig.GetStringPropertyFn(archivalStatus),
clusterDefaultBucket,
)
}
3 changes: 2 additions & 1 deletion common/persistence/persistence-tests/persistenceTestBase.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type (
EnableGlobalDomain bool // is global domain enabled
IsMasterCluster bool // is master cluster
ClusterMetadata cluster.Metadata
EnableArchival bool // is archival enabled
}

// TestBase wraps the base setup needed to create workflows over persistence layer.
Expand Down Expand Up @@ -134,7 +135,7 @@ func NewTestBaseWithSQL(options *TestBaseOptions) TestBase {
func newTestBase(options *TestBaseOptions, testCluster PersistenceTestCluster) TestBase {
metadata := options.ClusterMetadata
if metadata == nil {
metadata = cluster.GetTestClusterMetadata(options.EnableGlobalDomain, options.IsMasterCluster)
metadata = cluster.GetTestClusterMetadata(options.EnableGlobalDomain, options.IsMasterCluster, options.EnableArchival)
}
options.ClusterMetadata = metadata
return TestBase{
Expand Down
24 changes: 21 additions & 3 deletions host/client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,27 @@ func (s *clientIntegrationSuite) setupSuite(enableGlobalDomain bool, isMasterClu
// TODO: Use mock messaging client until we support kafka setup onebox to write end-to-end integration test
s.mockProducer = &mocks.KafkaProducer{}
s.mockMessagingClient = mocks.NewMockMessagingClient(s.mockProducer, nil)

s.host = NewCadence(s.ClusterMetadata, server.NewIPYarpcDispatcherProvider(), s.mockMessagingClient, s.MetadataProxy, s.MetadataManagerV2, s.ShardMgr, s.HistoryMgr, s.HistoryV2Mgr, s.ExecutionMgrFactory, s.TaskMgr,
s.VisibilityMgr, testNumberOfHistoryShards, testNumberOfHistoryHosts, s.logger, 0, false, s.enableEventsV2, false)
cadenceParams := &CadenceParams{
ClusterMetadata: s.ClusterMetadata,
DispatcherProvider: server.NewIPYarpcDispatcherProvider(),
MessagingClient: s.mockMessagingClient,
MetadataMgr: s.MetadataProxy,
MetadataMgrV2: s.MetadataManagerV2,
ShardMgr: s.ShardMgr,
HistoryMgr: s.HistoryMgr,
HistoryV2Mgr: s.HistoryV2Mgr,
ExecutionMgrFactory: s.ExecutionMgrFactory,
TaskMgr: s.TaskMgr,
VisibilityMgr: s.VisibilityMgr,
NumberOfHistoryShards: testNumberOfHistoryShards,
NumberOfHistoryHosts: testNumberOfHistoryHosts,
Logger: s.logger,
ClusterNo: 0,
EnableWorker: false,
EnableEventsV2: s.enableEventsV2,
EnableVisibilityToKafka: false,
}
s.host = NewCadence(cadenceParams)
s.host.Start()

s.engine = s.host.GetFrontendClient()
Expand Down
23 changes: 21 additions & 2 deletions host/integration_cross_dc_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,27 @@ func (s *integrationCrossDCSuite) setupTest(enableGlobalDomain bool, isMasterClu
s.mockProducer = &mocks.KafkaProducer{}
s.mockMessagingClient = mocks.NewMockMessagingClient(s.mockProducer, nil)

s.host = NewCadence(s.ClusterMetadata, client.NewIPYarpcDispatcherProvider(), s.mockMessagingClient, s.MetadataProxy, s.MetadataManagerV2, s.ShardMgr, s.HistoryMgr, s.HistoryV2Mgr, s.ExecutionMgrFactory, s.TaskMgr,
s.VisibilityMgr, testNumberOfHistoryShards, testNumberOfHistoryHosts, s.logger, 0, false, s.enableEventsV2, false)
cadenceParams := &CadenceParams{
ClusterMetadata: s.ClusterMetadata,
DispatcherProvider: client.NewIPYarpcDispatcherProvider(),
MessagingClient: s.mockMessagingClient,
MetadataMgr: s.MetadataProxy,
MetadataMgrV2: s.MetadataManagerV2,
ShardMgr: s.ShardMgr,
HistoryMgr: s.HistoryMgr,
HistoryV2Mgr: s.HistoryV2Mgr,
ExecutionMgrFactory: s.ExecutionMgrFactory,
TaskMgr: s.TaskMgr,
VisibilityMgr: s.VisibilityMgr,
NumberOfHistoryShards: testNumberOfHistoryShards,
NumberOfHistoryHosts: testNumberOfHistoryHosts,
Logger: s.logger,
ClusterNo: 0,
EnableWorker: false,
EnableEventsV2: s.enableEventsV2,
EnableVisibilityToKafka: false,
}
s.host = NewCadence(cadenceParams)

s.host.Start()

Expand Down
Loading

0 comments on commit 50423a0

Please sign in to comment.