-
Notifications
You must be signed in to change notification settings - Fork 89
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
IT test for resolve-test-dependencies with snapshots #480
Conversation
|
||
@Test | ||
public void testVersionOfDependency() throws IOException { | ||
Assert.assertEquals("2.0.0-SNAPSHOT", Version.getVersion()); |
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.
test will fail when run using the dependency declared in the pom, but will pass when using the version of the plugin in the war.
# First just build the plugin that we depend on | ||
invoker.goals.1=-f war-with-plugin -ntp -Dhpi-plugin.version=${project.version} clean install -P quick-build -Drevision=1.0.0-SNAPSHOT | ||
# Then build another version and create a war containing the newer version | ||
invoker.goals.2=-f war-with-plugin -ntp -Dhpi-plugin.version=${project.version} clean install -P quick-build -P build-war -Drevision=2.0.0-SNAPSHOT |
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.
slightly abnormal syntax of profile activation as invoker will split into multiple invocations on seeing a ,
so we use -P
twice
|
||
assert jf.getEntry('WEB-INF/plugins/override-war-with-snapshot.hpi') != null | ||
|
||
return true; |
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.
we do not need to perform any checking of the last invocation of the dependant plugin as the junit test will fail if the dependency is not updated.
<goal>custom-war</goal> | ||
</goals> | ||
<configuration> | ||
<addThisPluginToCustomWar>true</addThisPluginToCustomWar> |
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.
requires #479
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.
this plugin depends on the plugin in war-with-plugin
<dependency> | ||
<groupId>org.jenkins-ci.tools.hpi.its</groupId> | ||
<artifactId>override-war-with-snapshot</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> |
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.
this version will cause the tests to fail, and will pass when it is updated to 2.0.0-SNAPSHOT
|
||
public class Version { | ||
|
||
public static String getVersion() throws IOException { |
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.
will return a different version depending on the version of the plugin.
this introduces test coverage for both resolve-test-dependencies with overrideWar containing a SNAPSHOT plugin as well as custom-war with addThisPluginToCustomWar
the paths for files should not be absolute but relative. prior to this change the war contained files like WEB-INF/lib/... (all the usual entries) and /WEB-INF/plugins/.. (for the bundled plugins)
if the war scanning encounters a SNAPSHOT build of a plugin then then manifest file will contain a `Plugin-Version` entry like `1.2.3-4-SNAPSHOT (private abcd1234-username)`. This causes a failure when updating the dependencies as the plugin will try and use that directly without stripping off the extra parts. THis strips off any extra parts should they be present so that the version number matches a valid maven version number and also emits a warning to the log about non repeatable builds if any snapshots are encountered.
@@ -372,7 +372,7 @@ | |||
<localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath> | |||
<settingsFile>src/it/settings.xml</settingsFile> | |||
<pomIncludes> | |||
<pomInclude>*/pom.xml</pomInclude> | |||
<pomInclude>*</pomInclude> |
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.
any subdirectory (non recursive) of src/it
is now a valid IT - we do not need a pom.xml
in the root which allows us to have multiple projects for a single IT that do not share an aggregator
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.
this file is #481
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.
this file is #478
<developers> | ||
<developer> | ||
<id>Bob</id> | ||
<name>Bob McBobfaceNoam Chomsky</name> |
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.
Multiple names when a single name is expected
<name>Bob McBobfaceNoam Chomsky</name> | |
<name>Bob McBobface</name> |
this introduces test coverage for both
resolve-test-dependencies
withoverrideWar
containing aSNAPSHOT
plugin as well as custom-war withaddThisPluginToCustomWar
writing the IT was not done separately one for each PR or moved as this would have created more renamed files bloating the diff, or duplicating tests unnecessarily. The commits here are separate for each fix - but review in the respective PRs and the checks and order demonstrates each fix in turn)
overrideWar
#478Testing done
custom-war
mojo bundles HPI incorrectly #479)overrideWar
#478)Submitter checklist