Fix random failure in BulkCopyColumnMapping test#165
Fix random failure in BulkCopyColumnMapping test#165v-nisidh merged 2 commits intomicrosoft:devfrom ahmad-ibra:dev
Conversation
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 Report
@@ 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
Continue to review full report at Codecov.
|
| * @param autoGenerateSchema | ||
| * @param alternateSchema | ||
| */ | ||
| DBSchema(boolean autoGenerateSchema, boolean alternateSchema) { |
There was a problem hiding this comment.
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);
}
v-nisidh
left a comment
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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);
}
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.