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 unit tests for ValidateLongPollXXX #5553

Conversation

arzonus
Copy link
Contributor

@arzonus arzonus commented Dec 27, 2023

What changed?
Unit tests for ValidateLongPollContextTimeout and ValidateLongPollContextTimeoutIsSet have been added

Why?
ValidateLongPollContextTimeout and ValidateLongPollContextTimeoutIsSet were not covered by unit tests

How did you test it?
Unit tests are passed

Potential risks

Release notes

Documentation Changes

common/util_test.go Outdated Show resolved Hide resolved
@@ -1043,3 +1044,64 @@ func TestDeserializeSearchAttributeValue_Error(t *testing.T) {
})
}
}

func TestValidateLongPollContextTimeout(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

This could be turned into table formatted test to reduce repeated test body code.

tests := []struct {
  desc string
  loggerFn func() log.MockLogger
  timeout time.Duration
  wantErr error
} {
...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it can be turned, but I am not sure the readability will be improved. Also, 2 of 4 cases check errors, so it requires us to write conditionals. I'd like to leave it as it is.

…tests_for_ValidateLongPollXXX

# Conflicts:
#	common/util_test.go
…tests_for_ValidateLongPollXXX

# Conflicts:
#	common/util_test.go
@arzonus arzonus merged commit 82a8015 into cadence-workflow:master Jan 8, 2024
16 checks passed
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