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

IWF-103: Require every commandId to exist for ANY_COMMAND_COMBINATION_COMPLETED #423

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

lwolczynski
Copy link
Contributor

@lwolczynski lwolczynski commented Sep 19, 2024

No description provided.

@@ -224,12 +225,42 @@ func checkCommandRequestFromWaitUntilResponse(resp *iwfidl.WorkflowStateStartRes
return err
}
}
// Check if each command in the combinations has a matching command in one of the lists
if !areAllCommandCombinationsIdsValid(commandReq) {
return fmt.Errorf("ANY_COMMAND_COMBINATION_COMPLETED can only be used when every command has an commandId that is found in TimerCommands, SignalCommands or InterStateChannelCommands")
Copy link
Contributor

@longquanzheng longquanzheng Sep 19, 2024

Choose a reason for hiding this comment

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

InterStateChannelCommands has been renamed to InternalChannelCommand. There are still many places in server that hasn't updated. But all the API and error message that it returned should be using the new name for consistency.

@longquanzheng
Copy link
Contributor

longquanzheng commented Sep 19, 2024

The code looks good.
It will be better to add a test.
Unit tests are usually easier to write for those edge/error cases, but so far we only have integ test.

In next meeting, probably we can do unit tests together. I have been lazy to write unit tests but I think it's important.

But it's also possible to write integ tests --


Actually, I did write some unit tests, also for golang sdk and samples:

https://github.com/indeedeng/iwf/blob/main/service/common/log/loggerimpl/logger_test.go

https://github.com/indeedeng/iwf-golang-sdk/tree/main/iwftest

https://github.com/indeedeng/iwf-golang-sdk/blob/main/iwftest/example/example_test.go

gomock is probably the best option for mocking in my experience, also seems like people like it in the golang community: https://www.reddit.com/r/golang/comments/qe4a1c/what_mocking_framework_do_you_prefer/

@lwolczynski lwolczynski changed the title Draft: IWF-103: Require every commandId to exist for ANY_COMMAND_COMBINATION_COMPLETED IWF-103: Require every commandId to exist for ANY_COMMAND_COMBINATION_COMPLETED Sep 20, 2024
@lwolczynski
Copy link
Contributor Author

Added unit tests

@lwolczynski lwolczynski merged commit 997a5d4 into main Sep 23, 2024
3 of 5 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