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

Don't use err when it's nil #1046

Merged
merged 3 commits into from
Aug 14, 2018
Merged

Conversation

rfay
Copy link
Member

@rfay rfay commented Aug 13, 2018

The Problem/Issue/Bug:

In a couple of our tests we occasionally get panics because we get a nil for err and then use err.Error(). We shouldn't use a nil err.

How this PR Solves The Problem:

  • If err == nil, make sure we don't try to use err.Error()

This affects only tests, and only occasionally, so is a code-review.

See the fail/panic in https://buildkite.com/drud/ddev-macos/builds/489#6c3c127b-8d24-40f2-861e-9ea7704c07e3

@rfay rfay self-assigned this Aug 13, 2018
@rfay rfay requested a review from andrewfrench August 13, 2018 16:18
@CLAassistant
Copy link

CLAassistant commented Aug 13, 2018

CLA assistant check
All committers have signed the CLA.

@rfay rfay changed the title Fix assert.Error() chokes on err == nil Don't use err when it's nil Aug 13, 2018
@rfay rfay force-pushed the 20180813_testcommon_panic branch from b373a16 to 912360a Compare August 13, 2018 18:21
assert.Equal(err.Error(), "is archive")
if err != nil {
assert.Equal(err.Error(), "is archive")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to wait until the import-files refactor PR is in and rebase this as the function signature for ValidateAsset has changed, it now returns a bool isArchive value and doesn't rely on the error value.

@rfay rfay force-pushed the 20180813_testcommon_panic branch from 912360a to 9d2e270 Compare August 13, 2018 23:34
@rfay
Copy link
Member Author

rfay commented Aug 13, 2018

Rebased this, think it does what it should.

I did figure out that one test failure - there was a cached download for a tarball that should never have succeeded. Not sure how that happened, but cleaning up ~/.ddev/testcache/ fixed it I think.

Copy link
Contributor

@andrewfrench andrewfrench left a comment

Choose a reason for hiding this comment

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

Everything looks good after the rebase, 👍 from me

@rfay rfay merged commit 4d7d345 into ddev:master Aug 14, 2018
@rfay rfay deleted the 20180813_testcommon_panic branch August 14, 2018 00:48
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.

None yet

3 participants