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

Properly return postgres query errors on failure #2179

Merged
merged 1 commit into from Sep 23, 2017

Conversation

adamleff
Copy link
Contributor

When using the query method in the postgres_session resource, if the query fails, the query method attempts to call skip_resource with an error message. Not only does the skip_resource not properly work, but it also returns a String object back to the test which is probably going to try and call the output method on it to run the test.

This results in an error like this:

  Can't read
     ∅  undefined method `output' for "output":String

This change returns the full psql output as a Lines object to the user, including stderr, so they can at least get the error in their test output and avoids undefined method errors.

When using the `query` method in the `postgres_session` resource, if
the query fails, the `query` method attempts to call `skip_resource`
with an error message. Not only does the `skip_resource` not properly
work, but it also returns a `String` object back to the test which is
probably going to try and call the `output` method on it to run the test.

This results in an error like this:

```
  Can't read
     ∅  undefined method `output' for "output":String
```

This change returns the full psql output as a Lines object to the
user, including stderr, so they can at least get the error in their
test output and avoids undefined method errors.

Signed-off-by: Adam Leff <adam@leff.co>
@adamleff adamleff requested a review from a team as a code owner September 22, 2017 19:53
Copy link
Contributor

@arlimus arlimus 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 @adamleff for fixing this 😁

@arlimus arlimus merged commit d029f7f into master Sep 23, 2017
@arlimus arlimus deleted the adamleff/postgres-query-errors branch September 23, 2017 07:27
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

2 participants