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

mock: in order mock calls using new testify mock.InOrder() method #1743

Merged
merged 5 commits into from
Dec 6, 2024

Conversation

ReyOrtiz
Copy link
Contributor

@ReyOrtiz ReyOrtiz commented Dec 4, 2024

What was changed

Upgrading testify to v1.10.0.

Adding an InOrderMockCalls(calls ...*MockCallWrapper) helper method to setup mock calls in order. It implements a similar helper that was recently added and released in to https://github.com/stretchr/testify.

I had opened a similar PR in the past: #1623 but was canceled because the helper methods implemented in temporal are similar to the ones offered by "testify", and it was already added to "testify".

Why?

A more intuitive and cleaner way to define mock calls in order. For example:

env.InOrderMockCalls(
	env.OnActivity(namedActivity, mock.Anything, "call1").Return("result1", nil),
	env.OnActivity(namedActivity, mock.Anything, "call2").Return("result2", nil),
	env.OnActivity(namedActivity, mock.Anything, "call3").Return("result3", nil),
)

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

@ReyOrtiz ReyOrtiz requested a review from a team as a code owner December 4, 2024 23:41
@CLAassistant
Copy link

CLAassistant commented Dec 4, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Quinn-With-Two-Ns
Copy link
Contributor

Looks like your branch isn't up to date and there are merge conflicts, please rebase and then we can run CI, thanks for the contribution

@ReyOrtiz
Copy link
Contributor Author

ReyOrtiz commented Dec 5, 2024

Ok, branch rebased and merge conflicts resolved. Thanks!

@ReyOrtiz
Copy link
Contributor Author

ReyOrtiz commented Dec 5, 2024

is there anything I need to do to fix the pipeline failures?

@cretz
Copy link
Member

cretz commented Dec 5, 2024

You will want to run go mod tidy in all directories of the repo that have a go.mod file. See https://github.com/temporalio/sdk-go/blob/master/CONTRIBUTING.md#updating-go-mod-files.

@ReyOrtiz
Copy link
Contributor Author

ReyOrtiz commented Dec 5, 2024

Thanks and sorry I missed that. I ran go mod tidy on them.

@Quinn-With-Two-Ns
Copy link
Contributor

Just waiting on the CLA to be signed, then we can merge

@ReyOrtiz
Copy link
Contributor Author

ReyOrtiz commented Dec 6, 2024

Ok, I've signed a couple of times. It seems it doesn't refresh automatically.

Now says "You have agreed to the CLA for multiple repositories or organizations"

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit 1f35a5b into temporalio:master Dec 6, 2024
12 of 13 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.

5 participants