Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,32 @@ jobs:
- name: check yaml formatting
run: make lint-yaml

parallelize-tests:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-go@v6
with:
go-version-file: "go.mod"
check-latest: true
cache: true

- name: check test parallelization
run: make parallelize-tests

- name: check-is-dirty
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "Detected uncommitted changes after running parallelize-tests."
echo "Run 'make parallelize-tests' locally and commit the changes."
git status
git diff
exit 1
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ I think that's the clearest way to communicate without ambiguity


golangci:
runs-on: ubuntu-24.04-arm
steps:
Expand Down Expand Up @@ -163,6 +189,7 @@ jobs:
- fmt-imports
- lint-yaml
- golangci
- parallelize-tests
runs-on: ubuntu-24.04-arm
if: always()
env:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ fmt-imports: $(GCI) # Don't get confused, there is a single linter called gci, w
@printf $(COLOR) "Formatting imports..."
@$(GCI) write --skip-generated -s standard -s default ./*

parallelize-tests:
@printf $(COLOR) "Add t.Parallel() to tests..."
@go run ./cmd/tools/parallelize $(INTEGRATION_TEST_DIRS)

fmt-yaml: $(YAMLFMT)
@printf $(COLOR) "Formatting YAML files..."
@$(YAMLFMT) -conf .github/.yamlfmt .
Expand Down
15 changes: 15 additions & 0 deletions cmd/tools/parallelize/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"fmt"
"os"

"go.temporal.io/server/tools/parallelize"
)

func main() {
if err := parallelize.Main(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New little tool to automatically tag tests as "parallel".

14 changes: 14 additions & 0 deletions common/persistence/tests/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (s *recordingSession) Query(query string, args ...interface{}) gocql.Query
}

func TestCassandraShardStoreSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraExecutionMutableStateStoreSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraExecutionMutableStateTaskStoreSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraHistoryStoreSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraTaskQueueSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraFairTaskQueueSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraTaskQueueTaskSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraTaskQueueFairTaskSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraTaskQueueUserDataSuite(t *testing.T) {
t.Parallel()
testData, tearDown := setUpCassandraTest(t)
defer tearDown()

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

func TestCassandraHistoryV2Persistence(t *testing.T) {
t.Parallel()
s := new(persistencetests.HistoryV2PersistenceSuite)
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
s.TestBase.Setup(nil)
suite.Run(t, s)
}

func TestCassandraMetadataPersistenceV2(t *testing.T) {
t.Parallel()
s := new(persistencetests.MetadataPersistenceSuiteV2)
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
s.TestBase.Setup(nil)
suite.Run(t, s)
}

func TestCassandraClusterMetadataPersistence(t *testing.T) {
t.Parallel()
s := new(persistencetests.ClusterMetadataManagerSuite)
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
s.TestBase.Setup(nil)
suite.Run(t, s)
}

func TestCassandraQueuePersistence(t *testing.T) {
t.Parallel()
s := new(persistencetests.QueuePersistenceSuite)
s.TestBase = persistencetests.NewTestBaseWithCassandra(&persistencetests.TestBaseOptions{})
s.TestBase.Setup(nil)
Expand Down Expand Up @@ -315,6 +328,7 @@ func TestCassandraQueueV2Persistence(t *testing.T) {
}

func TestCassandraNexusEndpointPersistence(t *testing.T) {
t.Parallel()
cluster := persistencetests.NewTestClusterForCassandra(&persistencetests.TestBaseOptions{}, log.NewNoopLogger())
cluster.SetupTestDatabase()
t.Cleanup(cluster.TearDownTestDatabase)
Expand Down
Loading
Loading