-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 test false postives due to TestNG's #543 #7204
Fix test false postives due to TestNG's #543 #7204
Conversation
pom.xml
Outdated
@@ -881,6 +881,7 @@ | |||
<javaVersion>1.8</javaVersion> | |||
<failOnViolations>true</failOnViolations> | |||
<exclusionsFile>${air.main.basedir}/src/modernizer/exclusions.txt</exclusionsFile> | |||
<violationsFile>${air.main.basedir}/src/modernizer/violations.xml</violationsFile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment above <version>1.4.0</version>
that violationsFile
that violations file needs to be updated to match new version.
If we cannot do better.
@@ -0,0 +1,769 @@ | |||
<?xml version="1.0"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split this to commit which imports original violations.xml and one which modifies it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2556f14
to
472e2d4
Compare
Change all the commit message subjects to be "by TestNG bug" since GitHub wants to link to a Presto issue. |
Instead of copy/pasting the default violations, we should update the modernizer plugin to support additional files. I submitted a PR the other day and he merged it quickly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
472e2d4
to
a757afb
Compare
@electrum comments addressed. modernizer 1.5.0 has been released, including the needed changes. The build should pass now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is nice that you have found it! I don't understand why testng is so popular.
pom.xml
Outdated
@@ -875,12 +875,16 @@ | |||
<plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should first fix tests and then add violations. That way every commit has a chance to build. So please reorder commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree all commits should build when merged to master, so that bisects work. I introduced the changes in this order so that I see the static checks I introduced catch anything. I left it this way so far so that anyone can easily re-verify it. Will now rearrange the commits.
<comment>Use com.facebook.presto.testing.assertions.Assert.assertEquals due to TestNG #543</comment> | ||
</violation> | ||
|
||
</modernizer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now new line at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -267,7 +267,7 @@ | |||
<dependency> | |||
<groupId>org.testng</groupId> | |||
<artifactId>testng</artifactId> | |||
<scope>test</scope> | |||
<scope>provided</scope> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why it is changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the com.facebook.presto.testing.assertions.Assert
class depends on TestNG's assertions, and it has to be in src/main so that other modules can use it
@@ -116,7 +116,7 @@ public void testInnerJoin(boolean parallelBuild, boolean probeHashEnabled, boole | |||
); | |||
|
|||
// expected | |||
MaterializedResult expected = MaterializedResult.resultBuilder(taskContext.getSession(), concat(probePages.getTypes(), buildPages.getTypes())) | |||
MaterializedResult expected = MaterializedResult.resultBuilder(taskContext.getSession(), concat(probePages.getTypesWithoutHash(), buildPages.getTypesWithoutHash())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please squash this commit with the previous one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? I wanted the changes to be atomic. Also I think getTypesWithoutHash method addition is worth mentioning in the commit log for the ones reading it :)
b245e13
to
e585e7c
Compare
Rebased and addressed @kokosing's comments |
3e882cf
to
c2d4ed2
Compare
@electrum rebased on master |
@electrum kindly ping |
Regarding this sentence in one of the commit descriptions: "Jto address diffrences between cassandra and other connectors." "differences" has a typo. I'm assuming "Jto" is a typo as well. |
|
||
public class Assert extends org.testng.Assert | ||
{ | ||
private Assert() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format like
private Assert() {}
*/ | ||
package com.facebook.presto.testing.assertions; | ||
|
||
public class Assert extends org.testng.Assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extends
should go on next line
*/ | ||
package com.facebook.presto.testing.assertions; | ||
|
||
public class Assert extends org.testng.Assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "ExtendsUtilityClass"})
*/ | ||
package com.facebook.presto.testing.assertions; | ||
|
||
public class Assert extends org.testng.Assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment this class about why it is here
c2d4ed2
to
73e70ce
Compare
@electrum comments applied, back to you :) |
73e70ce
to
8d6556c
Compare
@electrum rebased, kindly ping :) |
@electrum kindly ping |
Extract parameterized test methods in AbstractTestQueries to address differences between cassandra and other connectors. See testng-team/testng#543.
This prevents false positive test results when comparing iterables (most notably: MaterializedResult instances) due to TestNG bug (testng-team/testng#543). False-positive results were found in ~20 tests and are fixed in the following commits.
8d6556c
to
3367b57
Compare
@electrum rebased and resolved conflicts. Please have a look, all comments are addressed so far. |
@electrum kindly bump. |
Merged, thanks! |
Because of TestNG #543 - Unexpected Behaviour: assertEquals for Iterable, ~20 tests are giving false positive results (all due to equality checks on
MaterializedResult
instances, which implementIterable
and because of that the 'types' field was not taken into account).The error could potentially occur in ~30 test classes. All potential and actual false positives are fixed and a static analysis check is added to prevent further breakage.
Even if it seems that no real bugs snuck through the false positives, the fixed tests are made to assert the status quo - so extra attention should be given to changes in their source.