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

Add client integration test for data converter #809

Merged
merged 7 commits into from
Jun 11, 2018
Merged

Add client integration test for data converter #809

merged 7 commits into from
Jun 11, 2018

Conversation

vancexu
Copy link
Contributor

@vancexu vancexu commented Jun 4, 2018

The new added testSuite can be used to write tests using cadence-client.
This pull request contains a test for client feature DataConverter.

On mac, running this test always cause a popup dialog asking you to "accept incoming connections".
Currently there is no good solution to get rid of this, you can press ESC each time or just turn off firewall.
This Yarpc related issue is fixed.


func TestClientIntegrationSuite(t *testing.T) {
flag.Parse()
if *integration {

Choose a reason for hiding this comment

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

where is this defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in onebox.go. This provide a flag to control whether to run integration or not, default to run integration test. It exists in all integration test suites.

ao := workflow.ActivityOptions{
ScheduleToStartTimeout: time.Minute,
StartToCloseTimeout: time.Minute,
HeartbeatTimeout: 20 * time.Second,

Choose a reason for hiding this comment

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

remove HeartbeatTimeout as we dont need it here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

return "", err1
}

logger.Info("Parent execution completed.", zap.String("Result", result+result1))

Choose a reason for hiding this comment

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

could you assert the result and result1 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

}

// testDataConverter implements encoded.DataConverter using gob
type testDataConverter struct{}

Choose a reason for hiding this comment

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

could you add 2 counter field to testDataConverter and increase them when ToData() and FromData() is called. We need to assert at the end of the test that they are called expected number of times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't look like integration test, because from this test level you don't care/know what is the correct call times. Also those counters will change if client change somewhere, which confuse people.
I added a TestClientDataConverter_Failed case to cover that different data converter is actually used.

Choose a reason for hiding this comment

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

I think it is valuable to verify that count number, and it is also good to verify that we don't call this encoding/decoding more than needed. For example, if there is a regression happen on client code that do this encoding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I am fine with that. Added.

if event.GetEventId() == 13 {
s.Equal(shared.EventTypeActivityTaskFailed, event.GetEventType())
}
if event.GetEventId() == 17 {

Choose a reason for hiding this comment

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

if there is no event with id 17, then this won't be called, and this test will pass without verifying what we want to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Add assertion.

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