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

[#31756][Prism] Add a test for getting state with MultimapSideInput StateKey #31757

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

mls3odp
Copy link
Contributor

@mls3odp mls3odp commented Jul 3, 2024

This addresses #31756 to increase test coverage of Prism.

Copy link
Contributor

github-actions bot commented Jul 3, 2024

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @jrmccluskey for label go.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Copy link
Contributor

@lostluck lostluck left a comment

Choose a reason for hiding this comment

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

Thank you very much!

Honestly, I couldn't find any good nits with this code, but I did leave my initial draft comments with links to the applicable external readability resource. I'll go ahead and merge this.

},
}
var testKey = []string{"a", "b", "x"}
expectedResult := map[string][]int{
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: in Go, we tend to use got and want as the idiomatic test words for what was received after processing and results that were desired.

But TBH since this is a lookup table for any specific want I think what's here is fine vs having want[key] downstream. The non-standard name makes the lookup pattern more visible.

for _, b := range resp.GetGet().GetData() {
got = append(got, int(b))
}
if !cmp.Equal(got, expectedResult[key]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Edit: Once I realized that this was comparing just individual primitive values, there's no real need for cmp.Diff. But here's the original comment I put down.


Consider using cmp.Diff instead which will provided a good printout for this.
See https://go.dev/wiki/TestComments#print-diffs

Note that for cmp.Diff, you want to pass want before got so the diff would be (-want, +got), which shows what's missing from what's wanted, and extra in what's received.

Aside: You're already doing the other usual bit of advice correctly for the message here "got before want": See https://go.dev/wiki/TestComments#got-before-want

@lostluck lostluck merged commit dbe7283 into apache:master Jul 3, 2024
6 checks passed
reeba212 pushed a commit to reeba212/beam that referenced this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants