Skip to content
Permalink
Browse files

[JENKINS-43094] Fingerprint.original for maven dependencies should be…

… null
  • Loading branch information
Cyrille Le Clerc
Cyrille Le Clerc committed Jun 10, 2017
1 parent 301bd81 commit ea4cffc05d62854dd3bbbe0ff578cb7979310a13
@@ -158,7 +158,7 @@ public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsE
for (Map.Entry<String, String> artifactToFingerprint : artifactsToFingerPrint.entrySet()) {
String artifactPathInFingerprintZone = artifactToFingerprint.getKey();
String artifactMd5 = artifactToFingerprint.getValue();
fingerprintMap.getOrCreate(run, artifactPathInFingerprintZone, artifactMd5).addFor(run);
fingerprintMap.getOrCreate(null, artifactPathInFingerprintZone, artifactMd5).addFor(run);
}

// add action
@@ -80,23 +80,22 @@ public void verify_fingerprinting_of_dependencies() throws Exception {
{ // first job using commons-lang3:3.5
firstPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-mono-dependency-maven-project-1");
firstPipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true));
WorkflowRun build = jenkinsRule.assertBuildStatus(Result.SUCCESS, firstPipeline.scheduleBuild2(0));
jenkinsRule.assertBuildStatus(Result.SUCCESS, firstPipeline.scheduleBuild2(0));

Fingerprint fingerprint = jenkinsRule.jenkins.getFingerprintMap().get(commonsLang3version35Md5);
assertThat(fingerprint, not(nullValue()));

Fingerprint.BuildPtr original = fingerprint.getOriginal();
assertThat(fingerprint.getFileName(), is("org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"));
assertThat(original.getName(), is(firstPipeline.getName()));
assertThat(original.getNumber(), is(1));
Fingerprint.BuildPtr original = fingerprint.getOriginal();
assertThat(original, is(nullValue()));
Hashtable<String, Fingerprint.RangeSet> usages = fingerprint.getUsages();
assertThat(usages.size(), is(1));
assertThat(usages.containsKey(firstPipeline.getName()), is(true));
}
{ // second job using commons-lang3:3.5
WorkflowJob secondPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-mono-dependency-maven-project-2");
secondPipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true));
WorkflowRun build = jenkinsRule.assertBuildStatus(Result.SUCCESS, secondPipeline.scheduleBuild2(0));
jenkinsRule.assertBuildStatus(Result.SUCCESS, secondPipeline.scheduleBuild2(0));

Fingerprint fingerprint = jenkinsRule.jenkins.getFingerprintMap().get(commonsLang3version35Md5);
assertThat(fingerprint, not(nullValue()));

0 comments on commit ea4cffc

Please sign in to comment.
You can’t perform that action at this time.