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

Fix random failure in BulkCopyColumnMapping test #165

Merged
merged 2 commits into from
Mar 7, 2017
Merged

Fix random failure in BulkCopyColumnMapping test #165

merged 2 commits into from
Mar 7, 2017

Conversation

ahmad-ibra
Copy link

Before, when two random tables are created, there was a small chance that they would have identical schemas. This caused the ImplicitMismatchCM test case to pass when it was expected to fail. Modified creation of destination table to always have a different schema from the source table.

Before, when two random tables are created, there was a small chance that they would have identical schemas. This caused the ImplicitMismatchCM test case to pass when it was expected to fail. Modified creation of destination table to always have a different schema from the source table.
@codecov-io
Copy link

codecov-io commented Mar 1, 2017

Codecov Report

Merging #165 into dev will decrease coverage by -0.15%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##               dev     #165      +/-   ##
===========================================
- Coverage     29.7%   29.56%   -0.15%     
+ Complexity    1248     1246       -2     
===========================================
  Files           97       97              
  Lines        23305    23305              
  Branches      3871     3871              
===========================================
- Hits          6923     6889      -34     
- Misses       15028    15064      +36     
+ Partials      1354     1352       -2
Flag Coverage Δ Complexity Δ
#JDBC41 29.49% <ø> (-0.12%) 1243 <ø> (-2)
#JDBC42 29.5% <ø> (-0.09%) 1245 <ø> (+1)
Impacted Files Coverage Δ Complexity Δ
src/main/java/microsoft/sql/DateTimeOffset.java 37.14% <0%> (-2.86%) 8% <0%> (-2%)
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 44.94% <0%> (-0.88%) 182% <0%> (ø)
...in/java/com/microsoft/sqlserver/jdbc/IOBuffer.java 31.69% <0%> (-0.42%) 0% <0%> (ø)
...m/microsoft/sqlserver/jdbc/SQLServerResultSet.java 17.61% <0%> (-0.33%) 127% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 369e5e0...1ff12c6. Read the comment docs.

* @param autoGenerateSchema
* @param alternateSchema
*/
DBSchema(boolean autoGenerateSchema, boolean alternateSchema) {
Copy link
Contributor

@v-nisidh v-nisidh Mar 2, 2017

Choose a reason for hiding this comment

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

Instead of copy paste you can use shuffle / reverse.

if(alternateSchema) {
Collections.shuffle(sqlTypes);
or
Collections.reverse(sqlTypes);
}

DBSchema(boolean autoGenerateSchema, boolean alternateSchema) { 
this(autoGenerateSchema);
if(alternateSchema) {
Collections.shuffle(this.sqlTypes);
}

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@v-nisidh v-nisidh left a comment

Choose a reason for hiding this comment

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

Think of rewriting DBSchema(...) by calling other constructor and on top of that shuffling instead of copy paste.

* @param alternateShcema
* <code>true</code>: creates table with alternate schema
*/
public DBTable(boolean autoGenerateSchema, boolean unicode, boolean alternateSchema) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can reduced copy paste by changing public DBTable(boolean autoGenerateSchema) and public DBTable(boolean autoGenerateSchema, boolean unicode)

Example:

public DBTable(boolean autoGenerateSchema) {
 this(autoGenerateSchema, false,false);  
}

Copy link
Author

Choose a reason for hiding this comment

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

done

@v-nisidh v-nisidh merged commit 1543625 into microsoft:dev Mar 7, 2017
@v-nisidh v-nisidh added this to the 6.1.5 milestone Mar 7, 2017
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.

3 participants