From c284c25d49da241b7876bab9fa8e293e6874b243 Mon Sep 17 00:00:00 2001 From: Madhu Ravichandran Date: Fri, 9 Feb 2018 10:58:27 -0800 Subject: [PATCH 1/2] Change cassandra test setup to use input port --- common/persistence/persistenceTestBase.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/persistence/persistenceTestBase.go b/common/persistence/persistenceTestBase.go index 603313cabaf..95b2396217e 100644 --- a/common/persistence/persistenceTestBase.go +++ b/common/persistence/persistenceTestBase.go @@ -123,7 +123,7 @@ func (s *TestBase) SetupWorkflowStoreWithOptions(options TestBaseOptions) { testAllClusterNames, ) // Setup Workflow keyspace and deploy schema for tests - s.CassandraTestCluster.setupTestCluster(options.KeySpace, options.DropKeySpace, options.SchemaDir) + s.CassandraTestCluster.setupTestCluster(options) shardID := 0 var err error s.ShardMgr, err = NewCassandraShardPersistence(options.ClusterHost, options.ClusterPort, options.ClusterUser, @@ -843,15 +843,16 @@ func (s *TestBase) ClearTransferQueue() { atomic.StoreInt64(&s.readLevel, 0) } -func (s *CassandraTestCluster) setupTestCluster(keySpace string, dropKeySpace bool, schemaDir string) { +func (s *CassandraTestCluster) setupTestCluster(options TestBaseOptions) { + keySpace := options.KeySpace if keySpace == "" { keySpace = generateRandomKeyspace(10) } - s.createCluster(testWorkflowClusterHosts, testPort, testUser, testPassword, testDatacenter, gocql.Consistency(1), + s.createCluster(testWorkflowClusterHosts, options.ClusterPort, testUser, testPassword, testDatacenter, gocql.Consistency(1), keySpace) - s.createKeyspace(1, dropKeySpace) - s.loadSchema([]string{"schema.cql"}, schemaDir) - s.loadVisibilitySchema([]string{"schema.cql"}, schemaDir) + s.createKeyspace(1, options.DropKeySpace) + s.loadSchema([]string{"schema.cql"}, options.SchemaDir) + s.loadVisibilitySchema([]string{"schema.cql"}, options.SchemaDir) } func (s *CassandraTestCluster) tearDownTestCluster() { From 58035628ffcd428f8fc2eb09b6c87cca557c8914 Mon Sep 17 00:00:00 2001 From: Madhu Ravichandran Date: Fri, 9 Feb 2018 11:40:03 -0800 Subject: [PATCH 2/2] Fix format --- common/persistence/persistenceTestBase.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/persistence/persistenceTestBase.go b/common/persistence/persistenceTestBase.go index 95b2396217e..86f080ae02d 100644 --- a/common/persistence/persistenceTestBase.go +++ b/common/persistence/persistenceTestBase.go @@ -848,8 +848,10 @@ func (s *CassandraTestCluster) setupTestCluster(options TestBaseOptions) { if keySpace == "" { keySpace = generateRandomKeyspace(10) } - s.createCluster(testWorkflowClusterHosts, options.ClusterPort, testUser, testPassword, testDatacenter, gocql.Consistency(1), - keySpace) + s.createCluster( + testWorkflowClusterHosts, options.ClusterPort, testUser, testPassword, testDatacenter, + gocql.Consistency(1), keySpace, + ) s.createKeyspace(1, options.DropKeySpace) s.loadSchema([]string{"schema.cql"}, options.SchemaDir) s.loadVisibilitySchema([]string{"schema.cql"}, options.SchemaDir)