Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate integration tests and unit tests #3760

Merged
merged 11 commits into from Jan 5, 2023
Merged

Conversation

yux0
Copy link
Contributor

@yux0 yux0 commented Dec 22, 2022

What changed?

  1. Refactor dependencies integration tests.
  2. Remove DB dependencies on unit tests target.
  3. Unit test reduce from 13 minutes to 2 minutes 30 seconds

Why?
Unit tests should not have dependencies other than testing and mocking libs.

How did you test it?
Existing tests.

Potential risks

Is hotfix candidate?

@@ -1,160 +0,0 @@
// The MIT License
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wxing1292 My understanding is those tests are covered in ./common/persistence/tests. So I can remove the tests from here?

Copy link
Contributor

Choose a reason for hiding this comment

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

if there are no tests referencing these setup, feel free to delete

@yux0 yux0 marked this pull request as ready for review December 23, 2022 02:31
@yux0 yux0 requested a review from a team as a code owner December 23, 2022 02:31
Makefile Outdated
INTEG_TEST_ROOT := ./host
INTEG_TEST_XDC_ROOT := ./host/xdc
INTEG_TEST_NDC_ROOT := ./host/ndc

INTEGRATION_TEST_ROOT := ./common/persistence/tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: DB_INTEGRATION_TEST_ROOT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also include ES tests and any future dependency integration tests. So I want to just use integration tests.

Copy link
Member

Choose a reason for hiding this comment

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

ES is also DB in this context. The path clearly points to persistence integration tests. If we have more integration tests in future, we will have another root and another var for it. So I would call this: PERSISTENCE_INTEGRATION_TEST_ROOT (yes, long, but clear).

suite.Run(t, s)
}

// TODO: Merge persistence-tests into the tests directory.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I did not delete the tests under persistence-tests dir.

Copy link
Member

Choose a reason for hiding this comment

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

May be it is time address this TODO, after you merge this PR.

@@ -59,10 +59,14 @@ endef

TEST_TIMEOUT := 20m

# TODO: INTEG_TEST should be functional tests
INTEG_TEST_ROOT := ./host
Copy link
Contributor

Choose a reason for hiding this comment

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

How about renaming this ./host dir, too, to something like ./host_tests? It could have a clearer directory name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do in the following PR

@mindaugasrukas
Copy link
Contributor

Please ensure those test utils don't end up in the final binary. We should probably add build tags to exclude them from the binary.

@yux0
Copy link
Contributor Author

yux0 commented Jan 4, 2023

Please ensure those test utils don't end up in the final binary. We should probably add build tags to exclude them from the binary.

Will migrate to use build tag in the following PR and make sure we don't build the test utils.

@@ -59,10 +59,14 @@ endef

TEST_TIMEOUT := 20m

# TODO: INTEG_TEST should be functional tests
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to address these TODOs first (in separate PR). Otherwise, we gonna have two different integration test sets and w/o looking at this PR it would be extremely hard to understand "why?".

Copy link
Member

Choose a reason for hiding this comment

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

Or you can do it right after. Just please don't postpone it.

Makefile Outdated
INTEG_TEST_ROOT := ./host
INTEG_TEST_XDC_ROOT := ./host/xdc
INTEG_TEST_NDC_ROOT := ./host/ndc

INTEGRATION_TEST_ROOT := ./common/persistence/tests
Copy link
Member

Choose a reason for hiding this comment

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

ES is also DB in this context. The path clearly points to persistence integration tests. If we have more integration tests in future, we will have another root and another var for it. So I would call this: PERSISTENCE_INTEGRATION_TEST_ROOT (yes, long, but clear).

suite.Run(t, s)
}

// TODO: Merge persistence-tests into the tests directory.
Copy link
Member

Choose a reason for hiding this comment

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

May be it is time address this TODO, after you merge this PR.

@yux0 yux0 merged commit ac8717c into temporalio:master Jan 5, 2023
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.

None yet

5 participants