-
Notifications
You must be signed in to change notification settings - Fork 108
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
add unit test for MigrationInterceptor #956
add unit test for MigrationInterceptor #956
Conversation
.withDomain(DOMAIN) | ||
.withWorkflowTypes(CrossDomainWorkflowTest.TestWorkflowCrossDomainImpl.class) | ||
.startWorkersAutomatically() | ||
.withTestEnvironmentProvider(TestWorkflowEnvironment::newInstance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default value of TestEnvironmentProvider, you can remove. The CrossDomainWorkflowTest had to specify it to share one environment across both workers since it had workflows signaling across domains.
public CadenceTestRule testRuleCur = | ||
CadenceTestRule.builder() | ||
.withDomain(DOMAIN) | ||
.withWorkflowTypes(CrossDomainWorkflowTest.TestWorkflowCrossDomainImpl.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this workflow used within the test? I think you can remove both withWorkflowTypes
and startWorkersAutomatically
since the test seems to create its own workers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense. I missed this
new FeatureFlags().setWorkflowExecutionAlreadyCompletedErrorEnabled(true)) | ||
.build()); | ||
IWorkflowService serviceNew, serviceCur; | ||
if (useDockerService) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the conditional logic you should be able to use the else
branch for both cases. If useDockerService is set to true then the IWorkflowClient in the test rules will be thrift clients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense
import org.junit.Assume; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.*; | ||
|
||
public class WorkflowMigrationTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: See if you can remove useDockerService entirely, the test rule should handle most cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do want to have an integration test from end to end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't think I explained this well, but the CadenceTestRule has the conditional logic within it already: https://github.com/uber/cadence-java-client/blob/704380bfaed0aa873fa19fe01d7bb0645c690c53/src/test/java/com/uber/cadence/testUtils/CadenceTestRule.java#L196
If USE_DOCKER_SERVICE
is set to true then CadenceTestRule will connect to the docker instance instead of creating a test service. The goal of the test rule is to avoid every test needing to have conditional logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I don't know that. I'll remove it completely
@@ -155,7 +179,7 @@ public void execute(int iter) { | |||
|
|||
@Test | |||
public void whenUseDockerService_cronWorkflowMigration() { | |||
Assume.assumeTrue(useDockerService); | |||
// Assume.assumeTrue(useDockerService); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove comment
} catch (Exception eDesc) { | ||
fail("fail to describe workflow execution in new domain: " + eDesc); | ||
} | ||
} | ||
} | ||
|
||
private DescribeWorkflowExecutionResponse describeWorkflowExecution( | ||
private GetWorkflowExecutionHistoryResponse getWorkflowHistory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Why change the type? Does this cover a different code path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe method is not implemented in test service
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted filessee 23 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
What changed?
Why?
unit test coverage
How did you test it?
Unit test
Potential risks
Release notes
Documentation Changes