Skip to content

[BEAM-12548] Add examples of Equals and EqualsList to equals_test.go#15112

Merged
lostluck merged 3 commits intoapache:masterfrom
jrmccluskey:beam12548
Jul 1, 2021
Merged

[BEAM-12548] Add examples of Equals and EqualsList to equals_test.go#15112
lostluck merged 3 commits intoapache:masterfrom
jrmccluskey:beam12548

Conversation

@jrmccluskey
Copy link
Copy Markdown
Contributor

Adds examples of the usages of Equals and EqualsList functions to equals_test.go. Covers successful usages with individual expected values, a PCollection of values, and an array/slice of values. Also shows the expected error message on a mismatch.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status Build Status Build Status --- Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@jrmccluskey
Copy link
Copy Markdown
Contributor Author

R: @lostluck

@jrmccluskey
Copy link
Copy Markdown
Contributor Author

Run GoPortable PreCommit

Copy link
Copy Markdown
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.

One comnment! Thanks! This will make things much clearer.

Comment on lines +177 to +179
if wrapper, ok := err.(interface{ Unwrap() error }); ok {
err = wrapper.Unwrap()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider hiding this in a helper method.

err = unwrapError(err)

Unnecessary details can detract from an example's utility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change made.


func unwrapError(err error) error {
if wrapper, ok := err.(interface{ Unwrap() error}); ok {
err = wrapper.Unwrap()
Copy link
Copy Markdown
Contributor

@lostluck lostluck Jul 1, 2021

Choose a reason for hiding this comment

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

Style wise, idiomatic go tends to just return early as needed, rather than trying for a single return.
Nothing wrong with the approach, and doesn't make a difference here but good to know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed just to start building that habit.

EqualsList(s, col, list)
err := ptest.Run(p)
err = unwrapError(err)
fmt.Println(err.Error())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not required to call the error message, the fmt.Print* functions are smart enough to pull out the .Error() themselves.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed for cleanliness

@lostluck lostluck merged commit 0715b66 into apache:master Jul 1, 2021
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