-
Notifications
You must be signed in to change notification settings - Fork 133
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
Adding tests for internal_workflow_client #1349
Merged
dkrotx
merged 7 commits into
cadence-workflow:master
from
dkrotx:coverage-internal_workflow_client
Jun 24, 2024
Merged
Adding tests for internal_workflow_client #1349
dkrotx
merged 7 commits into
cadence-workflow:master
from
dkrotx:coverage-internal_workflow_client
Jun 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50669f4
to
459d9f9
Compare
Without this mocks are not verified as expected (every table-test case'). While this would work, one might expect behavior like ``` for _, tt := range testcases { t.Run(tt.name, func(t* testing.T) { init-controller-and-mocks // test-code // mocks are verified here, at the end of subtest } } ``` Unfortunately, that's not the behavior you get with `s.Run(subtest func())` as controller is not re-initialized. In order to addres this gap testify introduced `SetupSubTest/TearDownSubTest` in v1.8.2 See stretchr/testify#1246 for more details SubTest behavior was fixed in v1.9.0 - otherwise failed mock expectations made parent test to fail, but child still succeeded. See stretchr/testify#1471 for more details
Basically copy-pasting the previous test for ListOpenWorkflow - those functions are look alike.
More code-coverage
459d9f9
to
9a29436
Compare
More tests to increase coverage of internal_workflow_client.go to 90%
Table tests for compactness. Failure cases do not check for input, just return error (this way it is less excessive).
3vilhamster
approved these changes
Jun 24, 2024
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.
LGTM.
Make common-fields check more explicit (actually, only required once, in happy-path). ExpectRPC always correlates with requestValidator
mrombout
pushed a commit
to softsense/cadence-client
that referenced
this pull request
Feb 26, 2025
Also Upgraded testify to get correct behaviour for subtests (table-tests)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added tests for internal_workflow_client
To increase code coverage
unit-tests
no risk