Skip to content

Commit 3a09867

Browse files
committed
Parallelize unit and integration tests
1 parent e44ad98 commit 3a09867

File tree

19 files changed

+436
-34
lines changed

19 files changed

+436
-34
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ci-build-misc: \
1818
shell-check \
1919
goimports \
2020
gomodtidy \
21+
parallelize-tests \
2122
ensure-no-changes
2223

2324
# Delete all build artifacts
@@ -408,6 +409,10 @@ fmt-imports: $(GCI) # Don't get confused, there is a single linter called gci, w
408409
@printf $(COLOR) "Formatting imports..."
409410
@$(GCI) write --skip-generated -s standard -s default ./*
410411

412+
parallelize-tests:
413+
@printf $(COLOR) "Add t.Parallel() to tests..."
414+
@go run ./cmd/tools/parallelize $(INTEGRATION_TEST_DIRS)
415+
411416
fmt-yaml: $(YAMLFMT)
412417
@printf $(COLOR) "Formatting YAML files..."
413418
@$(YAMLFMT) -conf .github/.yamlfmt .

cmd/tools/parallelize/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"go.temporal.io/server/tools/parallelize"
8+
)
9+
10+
func main() {
11+
if err := parallelize.Main(); err != nil {
12+
fmt.Fprintln(os.Stderr, err)
13+
os.Exit(1)
14+
}
15+
}

common/persistence/tests/cassandra_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ func (s *recordingSession) Query(query string, args ...interface{}) gocql.Query
120120
}
121121

122122
func TestCassandraShardStoreSuite(t *testing.T) {
123+
t.Parallel()
123124
testData, tearDown := setUpCassandraTest(t)
124125
defer tearDown()
125126

@@ -138,6 +139,7 @@ func TestCassandraShardStoreSuite(t *testing.T) {
138139
}
139140

140141
func TestCassandraExecutionMutableStateStoreSuite(t *testing.T) {
142+
t.Parallel()
141143
testData, tearDown := setUpCassandraTest(t)
142144
defer tearDown()
143145

@@ -161,6 +163,7 @@ func TestCassandraExecutionMutableStateStoreSuite(t *testing.T) {
161163
}
162164

163165
func TestCassandraExecutionMutableStateTaskStoreSuite(t *testing.T) {
166+
t.Parallel()
164167
testData, tearDown := setUpCassandraTest(t)
165168
defer tearDown()
166169

@@ -186,6 +189,7 @@ func TestCassandraExecutionMutableStateTaskStoreSuite(t *testing.T) {
186189
// TODO: Merge persistence-tests into the tests directory.
187190

188191
func TestCassandraHistoryStoreSuite(t *testing.T) {
192+
t.Parallel()
189193
testData, tearDown := setUpCassandraTest(t)
190194
defer tearDown()
191195

@@ -199,6 +203,7 @@ func TestCassandraHistoryStoreSuite(t *testing.T) {
199203
}
200204

201205
func TestCassandraTaskQueueSuite(t *testing.T) {
206+
t.Parallel()
202207
testData, tearDown := setUpCassandraTest(t)
203208
defer tearDown()
204209

@@ -212,6 +217,7 @@ func TestCassandraTaskQueueSuite(t *testing.T) {
212217
}
213218

214219
func TestCassandraFairTaskQueueSuite(t *testing.T) {
220+
t.Parallel()
215221
testData, tearDown := setUpCassandraTest(t)
216222
defer tearDown()
217223

@@ -225,6 +231,7 @@ func TestCassandraFairTaskQueueSuite(t *testing.T) {
225231
}
226232

227233
func TestCassandraTaskQueueTaskSuite(t *testing.T) {
234+
t.Parallel()
228235
testData, tearDown := setUpCassandraTest(t)
229236
defer tearDown()
230237

@@ -238,6 +245,7 @@ func TestCassandraTaskQueueTaskSuite(t *testing.T) {
238245
}
239246

240247
func TestCassandraTaskQueueFairTaskSuite(t *testing.T) {
248+
t.Parallel()
241249
testData, tearDown := setUpCassandraTest(t)
242250
defer tearDown()
243251

@@ -251,6 +259,7 @@ func TestCassandraTaskQueueFairTaskSuite(t *testing.T) {
251259
}
252260

253261
func TestCassandraTaskQueueUserDataSuite(t *testing.T) {
262+
t.Parallel()
254263
testData, tearDown := setUpCassandraTest(t)
255264
defer tearDown()
256265

@@ -264,27 +273,31 @@ func TestCassandraTaskQueueUserDataSuite(t *testing.T) {
264273
}
265274

266275
func TestCassandraHistoryV2Persistence(t *testing.T) {
276+
t.Parallel()
267277
s := new(persistencetests.HistoryV2PersistenceSuite)
268278
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
269279
s.TestBase.Setup(nil)
270280
suite.Run(t, s)
271281
}
272282

273283
func TestCassandraMetadataPersistenceV2(t *testing.T) {
284+
t.Parallel()
274285
s := new(persistencetests.MetadataPersistenceSuiteV2)
275286
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
276287
s.TestBase.Setup(nil)
277288
suite.Run(t, s)
278289
}
279290

280291
func TestCassandraClusterMetadataPersistence(t *testing.T) {
292+
t.Parallel()
281293
s := new(persistencetests.ClusterMetadataManagerSuite)
282294
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
283295
s.TestBase.Setup(nil)
284296
suite.Run(t, s)
285297
}
286298

287299
func TestCassandraQueuePersistence(t *testing.T) {
300+
t.Parallel()
288301
s := new(persistencetests.QueuePersistenceSuite)
289302
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
290303
s.TestBase.Setup(nil)
@@ -315,6 +328,7 @@ func TestCassandraQueueV2Persistence(t *testing.T) {
315328
}
316329

317330
func TestCassandraNexusEndpointPersistence(t *testing.T) {
331+
t.Parallel()
318332
cluster := persistencetests.NewTestClusterForCassandra(&persistencetests.TestBaseOptions{}, log.NewNoopLogger())
319333
cluster.SetupTestDatabase()
320334
t.Cleanup(cluster.TearDownTestDatabase)

0 commit comments

Comments
 (0)