Fix for random JUnit failures in framework tests#762
Fix for random JUnit failures in framework tests#762cheenamalhotra merged 7 commits intomicrosoft:devfrom
Conversation
# Resolved Conflicts: # src/test/java/com/microsoft/sqlserver/testframework/DBColumn.java
Codecov Report
@@ Coverage Diff @@
## dev #762 +/- ##
===========================================
- Coverage 48.17% 48.1% -0.08%
+ Complexity 2776 2772 -4
===========================================
Files 116 116
Lines 27854 27854
Branches 4636 4636
===========================================
- Hits 13418 13398 -20
- Misses 12215 12236 +21
+ Partials 2221 2220 -1
Continue to review full report at Codecov.
|
| } else { | ||
| CurrentRow[j] = sqlType.createdata(); | ||
| if(j==0) { | ||
| CurrentRow[j] = i+1; |
There was a problem hiding this comment.
Can't we just use SQL Server's auto-increment instead?
There was a problem hiding this comment.
Tried that, but it requires IDENTITY_INSERT to be enabled in order to make TVP and Bulk Copy work, with lots of test changes. I don't think it's worth the effort if we have to eventually enable IDENTITY_INSERT.
| columnValues.add(i+1); | ||
| } | ||
|
|
||
| } No newline at end of file |
| /** | ||
| * @return Escaped "columnName" | ||
| */ | ||
| public String getEscapedColumnName() { |
There was a problem hiding this comment.
This will fail if column name contains ] or [.
There was a problem hiding this comment.
Our table columns in tests don't contain either, so it has no impact in our tests.
| * Updates rowIndexes to all rows | ||
| * @param totalRows number of rows | ||
| */ | ||
| public void populateRowId(int totalRows) { |
There was a problem hiding this comment.
How are the rest of the columns populated? Can't we just fetch id from the table too?
There was a problem hiding this comment.
This function and populateValues above in the same file, populate data in 'columnValues' which are inserted iteratively in the table creation process. This is first time data insertion, so can't be fetched from anywhere.
Fixes random test failures due to unordered Select Queries in framework tests.
Although there are similar implementations in other tests which need to be fixed, this PR focuses on the tests that have been observed failing and are designed using framework package.