maven-integration-testing icon indicating copy to clipboard operation
maven-integration-testing copied to clipboard

[MRESOLVER-247] IT update for resolver behaviour change

Open cstamas opened this issue 3 years ago • 2 comments

Once MRESOLVER-247 is merged, and maven consumes it, this IT will fail, as maven will resolve LESS then this IT expects.

This change makes IT perform same assertion ("no POM is read twice") but without locking down the absolute number of POMs read.

cstamas avatar Mar 11 '22 15:03 cstamas

I don't understand this change. Why 140+? And how did + 4 make it to - 4? Moving the expected value to a constant make sense, but the rest is unclear.

Changes one by one:

  • The assert for 140+ is really just to exclude false positives (ie. Maven does not parse even one POM). We KNOW there are hundred-something POMs to parse, but we DO NOT WANT to fix that number (as will change between DFS/BFS/skipper)
  • instead to assert lines in log (created by agent), we "remember" the count, then we make that list unique, and compare size again
  • the +4 was factored out, the sum was asserted (168+4), so assertion happened with 172, hence, to get 168 out of 172 we do -4.
  • In other words (applies to testWithBuildConsumer) method only: we KNOW that reactor POMs are read twice (and reactor has 2 POMs, hence we "correct" the count with -4)
  • finally, I have a list of strings, making them unique by file path (using model.building.source) and asserting result is list.size - 1 = uniqList.size (as super pom is OMITTED from uniq list, it has NO model.building.sourcre).

Example of log entries for POM that went thru model builder vs Super POM (reformatted for easier read, they are all one liners):

{
  org.apache.maven.model.io.inputSource=null null, 
  org.apache.maven.model.io.isStrict=true, 
  org.apache.maven.model.building.source=/home/cstamas/Worx/apache-maven/maven-integration-testing/core-it- suite/target/test-classes/mng-5669-read-poms-once/module3/pom.xml
}, 
{
  org.apache.maven.model.io.inputSource=org.apache.maven:maven-model-builder:4.0.0-alpha-1-SNAPSHOT:super-pom jar:file:/home/cstamas/Worx/apache-maven/maven-integration-testing/core-it-suite/target/apache-maven/lib/maven-model-builder-4.0.0-alpha-1-SNAPSHOT.jar!/org/apache/maven/model/pom-4.0.0.xml, 
  xml:4.0.0=xml:4.0.0
}

cstamas avatar Mar 11 '22 19:03 cstamas

Is this one still necessary?

michael-o avatar Oct 30 '22 10:10 michael-o