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

test: fix metadata test to use explicit PK/FK names #1442

Merged
merged 2 commits into from
Mar 16, 2019

Conversation

sehrope
Copy link
Member

@sehrope sehrope commented Mar 14, 2019

Travis build against HEAD fails due to some changes in automated foreign key naming. Ex: #1435 (comment)_

This PR gives explicit names to the failing tests so that the results are consistent across versions.

Also, enhances the validation for that test to better validate the column order and row counts.

Changes testCrossReference() to validate the retrieved primary and foreign key columns
against their expected values. Previously it would have accepted them in either order or
the same value repeated twice for each.

Also checks to ensure that the expected number of rows are actually returned. Previously
it would have skipped all the checks if no rows were returned.
@sehrope sehrope mentioned this pull request Mar 14, 2019
8 tasks
@AppVeyorBot
Copy link

Build pgjdbc 1.0.169 completed (commit 04a5ea632a by @sehrope)

@codecov-io
Copy link

Codecov Report

Merging #1442 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #1442      +/-   ##
============================================
+ Coverage     68.74%   68.75%   +0.01%     
- Complexity     3902     3903       +1     
============================================
  Files           179      179              
  Lines         16414    16414              
  Branches       2672     2672              
============================================
+ Hits          11284    11286       +2     
+ Misses         3882     3881       -1     
+ Partials       1248     1247       -1

@vlsi vlsi changed the title Fix metadata test to use explicit PK/FK names test: fix metadata test to use explicit PK/FK names Mar 16, 2019
@vlsi vlsi merged commit 42d6bfa into pgjdbc:master Mar 16, 2019
@sehrope
Copy link
Member Author

sehrope commented Mar 16, 2019

🎉

}
assertEquals(2, numRows);
Copy link
Member

Choose a reason for hiding this comment

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

Technically speaking, this should have been assertEquals("dbmd.getCrossReference should return 2 rows since primary key m_pkey was created as (m,n)", 2, numRows)

It does not hurt much, but it does bother when it fails like "expected: 2, got: 3".

The same for assertEquals above.

Something like assertEquals("FK column " + j, expectedFkColumnNames[j - 1], fkColumnName); would make failure messages much more convenient.

Thanks for the understanding.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!

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

5 participants