Bug 1650234

Summary: rubygem-pg test suite fails with upgrade of PG from 10.5 => {10.6,11.0}
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: rubygem-pgAssignee: Vít Ondruch <vondruch>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anon.amish, devrim, dominic, hhorak, jmlich83, jstanek, pkajaba, pkubat, praiskup, ruby-packagers-sig, tgl, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-pg-1.0.0-3.fc28 rubygem-pg-1.0.0-3.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-19 01:54:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vít Ondruch 2018-11-15 16:08:11 UTC
Description of problem:
Recent updates of PG results in test suite failures of rubygem-pg:

~~~
Failures:
  1) PG::Connection server ping returns correct response when ping connection arguments are wrong
     Failure/Error: expect( ping ).to eq( PG::PQPING_NO_ATTEMPT )
       expected: 3
            got: 2
       (compared using ==)
     # ./spec/pg/connection_spec.rb:1104:in `block (3 levels) in <top (required)>'
     # ./spec/helpers.rb:31:in `block in included'
Finished in 54.74 seconds (files took 0.50386 seconds to load)
375 examples, 1 failure, 1 pending
~~~

This affects F29+:

https://apps.fedoraproject.org/koschei/package/rubygem-pg?collection=f29
https://apps.fedoraproject.org/koschei/package/rubygem-pg?collection=f30

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
rubygem-pg test suite fails.


Expected results:
rubygem-pg test suite passes.


Additional info:
This the calls-stack:

https://bitbucket.org/ged/ruby-pg/annotate/0fd7bb2494e8cc11c71c05f8f12deafa6b41fb37/spec/pg/connection_spec.rb?at=default&fileviewer=file-view-default#connection_spec.rb-1158
https://bitbucket.org/ged/ruby-pg/src/0fd7bb2494e8cc11c71c05f8f12deafa6b41fb37/ext/pg_connection.c?at=default&fileviewer=file-view-default#pg_connection.c-369
https://bitbucket.org/ged/ruby-pg/src/0fd7bb2494e8cc11c71c05f8f12deafa6b41fb37/lib/pg/connection.rb?at=default&fileviewer=file-view-default#connection.rb-82

The string passed into ```PQping``` is " fallback_application_name='/usr/bin/rspec' host='localhost' port='localhost' dbname='test'" which looks reasonable, although there is space at the beginning. Not sure ...

Comment 1 Tom Lane 2018-11-15 16:46:31 UTC
[ pokes around... ] This is a behavioral change in PQping as a consequence of upstream commit 6953daf08e6b1ef333758f6cda54de228212f12e.  The given string is in fact wrong, because 'localhost' is not a valid value for "port" - that has to be a port number.  However, validation of both the host name and port number have been postponed to the connection phase as a consequence of the fact that they're now allowed to be lists.  That means that instead of getting a "no attempt" result, you get a "no response" result; "no attempt" is only returned if initial parsing of the string fails.

I don't think this is a bug exactly; it's a matter of the test exercising an unspecified corner case and expecting a particular error code rather than some other error code.  If you want something that will provoke PQPING_NO_ATTEMPT reliably, I'd suggest using a connection string that's syntactically malformed or attempts to set an unrecognized parameter name.

Comment 2 Vít Ondruch 2018-11-15 17:43:48 UTC
Thx for looking into it.

The test is intentionally testing the wrong parameters submitted:

~~~
it "returns correct response when ping connection arguments are wrong" do
	ping = described_class.ping('localhost', 'localhost', nil, nil, :test, nil, nil)
	expect( ping ).to eq( PG::PQPING_NO_ATTEMPT )
end
~~~

If the PG change is intentional, then the rubygem-pg should probably change the test case somehow.

Just FYI, this is the commit which introduced the test case:

https://bitbucket.org/ged/ruby-pg/commits/fec045ed060d07dfd42cb7b1638d99eb973428af

It does not look they would test any specific user issue.

Comment 3 Vít Ondruch 2018-11-15 17:51:20 UTC
Lets see what rubygem-pg upstream thinks about it:

https://bitbucket.org/ged/ruby-pg/issues/287/pg-connection-server-ping-returns-correct

Comment 4 Vít Ondruch 2019-01-09 13:46:45 UTC
It was resolved by rubygem-pg upstream.

Comment 5 Fedora Update System 2019-01-09 14:01:16 UTC
rubygem-pg-1.0.0-3.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-ee30eb9dae

Comment 6 Fedora Update System 2019-01-09 14:01:57 UTC
rubygem-pg-1.0.0-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-d344ca380e

Comment 7 Fedora Update System 2019-01-11 04:16:29 UTC
rubygem-pg-1.0.0-3.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-ee30eb9dae

Comment 8 Fedora Update System 2019-01-11 05:42:31 UTC
rubygem-pg-1.0.0-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-d344ca380e

Comment 9 Fedora Update System 2019-01-19 01:54:44 UTC
rubygem-pg-1.0.0-3.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2019-01-19 02:25:51 UTC
rubygem-pg-1.0.0-3.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.