Skip to content
Permalink
Browse files

[JENKINS-27042] Reproduce in test

  • Loading branch information...
olivergondza committed Feb 21, 2015
1 parent 178e8f8 commit 76d4c256df3f7e3b4cbaca6cdb239c4b7f723c11
Showing with 29 additions and 0 deletions.
  1. +29 −0 src/test/java/plugins/CompressArtifactsPluginTest.java
@@ -25,11 +25,13 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;

import org.jenkinsci.test.acceptance.Matcher;
import org.jenkinsci.test.acceptance.junit.AbstractJUnitTest;
import org.jenkinsci.test.acceptance.junit.Bug;
import org.jenkinsci.test.acceptance.junit.Since;
import org.jenkinsci.test.acceptance.junit.WithPlugins;
import org.jenkinsci.test.acceptance.plugins.compress_artifacts.CompressingArtifactManager;
@@ -75,6 +77,33 @@ public void access_uncompressed_artifact_after_plugin_was_installed() {
assertThat(build, not(hasCompressedArtifacts()));
}

@Test @Bug("JENKINS-27042")
@WithPlugins("compress-artifacts")
public void archiveLargerThan4GInTotal() throws Exception {
configureArtifactCompression();

FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.addPublisher(ArtifactArchiver.class).includes("*");
job.addBuildStep(ShellBuildStep.class).command( // Generate archive larger than 4G
"wget $JENKINS_URL/jnlpJars/jenkins-cli.jar -O stuff.jar; for i in {0..7000}; do cp -l stuff.jar stuff.${i}.jar; done"
);
job.save();

Build build = job.scheduleBuild().waitUntilFinished(10 * 60).shouldSucceed();

long length = Long.parseLong(jenkins.runScript(
"new FilePath(Jenkins.instance.getJob('%s').lastBuild.artifactsDir).parent.child('archive.zip').length()",
job.name
));
assertThat(length, greaterThanOrEqualTo(4L * 1024 * 1024 * 1024));

build.getArtifact("stuff.jar").open();
for (int i = 1; i <= 70; i++) {
build.getArtifact("stuff." + i + "42.jar").open();
}
}

private void installCompressPlugin() {
@SuppressWarnings("deprecation")
boolean restart = jenkins.getPluginManager().installPlugins("compress-artifacts");

0 comments on commit 76d4c25

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