Skip to content

Test RetriableReader - #1482

Merged
ttaylorr merged 4 commits into
masterfrom
no-rewrap
Aug 26, 2016
Merged

ttaylorr merged 4 commits into
masterfrom
no-rewrap

Conversation

@ttaylorr

Copy link
Copy Markdown
Contributor

This pull-request is a small addendum to @larsxschneider's #1454 to add tests around the RetriableReader.

The only behavior change in this PR is that RetriableReader will no longer re-wrap already retriable errors, per #1454 (comment).

/cc @technoweenie @larsxschneider for 💭 and 👀

Comment thread tools/iotools.go
// Otherwise, if the error is non-nill and already retriable (in the
// case that the underlying reader `r.reader` is itself a
// `*RetriableReader`, return the error wholesale:
if err == nil || err == io.EOF || errors.IsRetriableError(err) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch!

@ttaylorr

Copy link
Copy Markdown
Contributor Author

Travis seems to be misreporting builds as having failed, even though all of the tests are passing as expected. I kicked off a restart of the builds and will begin the 1.4.1 release process as soon as this is merged in.

@ttaylorr
ttaylorr merged commit 020b0df into master Aug 26, 2016
@ttaylorr
ttaylorr deleted the no-rewrap branch August 26, 2016 18:37
chrisd8088 added a commit that referenced this pull request Aug 5, 2026
In PR #1454 we added the RetriableReader structure to our "tools"
package, and then in commit a9bbe0e
of PR #1482 we introduced several Go test functions to exercise the
structure's methods under various conditions.  We defined these
functions in our "tools/iotools_test.go" source file and set the
Go package name in the file to "tools_test" rather than just "tools".

One consequence of this difference is that we then need to import
our own "tools" package into the "tools/iotools_test.go" source file
even though it resides in the same directory as the rest of our
"tools" package's source files.

Previously, in commit 1ef2d43
of PR #1265, we moved the definition of the CopyWithCallback()
function from our "lfs" package to our "tools" package, and also
moved the corresponding TestCopyWithCallback() test function at
the same time.  These functions were previously defined in the
"util.go" and "util_test.go" source files, respectively, in our
"lfs" package.

However, while we now define both functions in our "tools" package,
the CopyWithCallback() function is located in a source file named
"iotools.go" but the TestCopyWithCallback() function is still located
in a source file named "util_test.go".

In a subsequent commit in this PR we intend to move the
TestCopyWithCallback() function into the "tools/iotools_test.go"
source file, to align with the location of the corresponding
CopyWithCallback() function in the "tools/iotools.go" file.

As well, in other future commits in this PR we expect to migrate
the "closingByteReader" structure and its related methods from the
"tools/copycallback.go" source file to the "tools/iotools.go" file,
and to add a new test function to the "tools/iotools_test.go" source
file which exercises the structure's Close() method.

At present, any test functions in the "tools/iotools_test.go"
source file must explicitly reference the structures and methods
they test using the "tools." prefix, since the source file
specifies a distinct "tools_test" Go package name.

To simplify the changes we expect to make in subsequent commits in
this PR, we therefore first change the package name in the
"tools/iotools_test.go" source file to just "tools", and update
the existing test functions for the RetriableReader structure to
remove the "tools." prefix from their references to the
NewRetriableReader() function.
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