Skip to content

Introduce TestClusterFactory#5118

Merged
rodrigozhou merged 2 commits intotemporalio:mainfrom
aromanovich:customizable-tests
Dec 1, 2023
Merged

Introduce TestClusterFactory#5118
rodrigozhou merged 2 commits intotemporalio:mainfrom
aromanovich:customizable-tests

Conversation

@aromanovich
Copy link
Copy Markdown
Contributor

What changed?
Functional test suites use TestCluster (defined in tests/test_cluster.go) that rely on TestBase (defined in common/persistence/persistence-tests/persistence_test_base.go).
This PR introduces factories that allow changing how these components are created.

Why?
The goal is to make Temporal functional tests customizable and exportable to ease the development of custom Temporal server implementations. My case is https://github.com/yandex/temporal-over-ydb. Its README describes the only currently possible way to run Temporal functional tests from the outside, which is to copy them over and patch.

This PR targets the "customizable" part and makes it possible to run tests over custom persistence by implementing TestClusterFactory and PersistenceTestBaseFactory and feeding them into all test suites.

If this PR is accepted, the next steps would be to make test suites exportable by:

  • capitalizing their names (e.g. functionalSuiteFunctionalSuite);
  • moving them from *_test.go to .go files.

Once we do that, we get the ability to import functional test suites from go.temporal.io/server/tests, instantiate them with custom TestClusterFactory and PersistenceTestBaseFactory and run tests. This approach now possible with go.temporal.io/server/common/persistence/persistence-tests, for example: https://github.com/yandex/temporal-over-ydb/blob/main/tests/persistencetests/ydb_test.go#L8.

How did you test it?
Ran tests.

Potential risks
None.

Is hotfix candidate?
No.

@aromanovich
Copy link
Copy Markdown
Contributor Author

@rodrigozhou Could you please take a look at this one as well? 🙂 I'm not sure I've chosen the best approach, so I would appreciate any feedback.

@rodrigozhou rodrigozhou self-requested a review November 29, 2023 21:39
Comment thread tests/test_cluster.go Outdated
@rodrigozhou rodrigozhou merged commit d9f7712 into temporalio:main Dec 1, 2023
rodrigozhou pushed a commit that referenced this pull request Dec 5, 2023
## What changed?
Names of all test suites were capitalized.

## Why?
Following up on #5118 and
making another step towards exportable functional test suites.

If this PR gets merged, the next (and the final one) PR will move the
test suite implementations from `*_test.go` to `.go` files.

## How did you test it?
Ran tests.

## Potential risks
Merge conflicts in other PRs.

## Is hotfix candidate?
No.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants