Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-07-23 06:18:40 -0400
committerAlexander Kurtakov2018-10-03 04:46:25 -0400
commitec7df4a73c9576d509de6fc80ac5fae29197b365 (patch)
tree8f3f4c835b1e7e4843811865dc162784e3a3115e
parentab78d64c030e003435d1b2430c99a8c64d621c1b (diff)
downloadrt.equinox.p2-ec7df4a73c9576d509de6fc80ac5fae29197b365.tar.gz
rt.equinox.p2-ec7df4a73c9576d509de6fc80ac5fae29197b365.tar.xz
rt.equinox.p2-ec7df4a73c9576d509de6fc80ac5fae29197b365.zip
Bug 536326 - Add failing test w/mirrors into MirrorRequestTestI20181004-1800I20181003-2215I20181003-1800
As MirrorRequest keeps re-trying more mirrors than OrderedMirrorSelector has: java.lang.ArrayIndexOutOfBoundsException: 3 at org.eclipse.equinox.p2.tests.artifact.repository.MirrorRequestTest$OrderedMirrorSelector.nextMirror(MirrorRequestTest.java:426) at org.eclipse.equinox.p2.tests.artifact.repository.MirrorRequestTest$OrderedMirrorSelector.getMirrorLocation(MirrorRequestTest.java:417) at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.getMirror(SimpleArtifactRepository.java:742) at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.downloadArtifact(SimpleArtifactRepository.java:639) at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.getArtifact(SimpleArtifactRepository.java:772) at org.eclipse.equinox.p2.tests.artifact.repository.MirrorRequestTest$RemoteRepo.getArtifact(MirrorRequestTest.java:319) at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.getArtifact(MirrorRequest.java:316) at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.transferSingle(MirrorRequest.java:286) at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.transfer(MirrorRequest.java:222) at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.perform(MirrorRequest.java:176) at org.eclipse.equinox.p2.tests.artifact.repository.MirrorRequestTest.testFailToCanonicalWithMirrors(MirrorRequestTest.java:120) Change-Id: I76888490a4fa76b02bd7e037247f07a6e8cfb616 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/emptyJarRepo/mirror-two/plugins/fail_to_canonical_1.0.0.txt.pack.gz1
2 files changed, 28 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
index c55ef645c..81f34ef26 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
@@ -104,6 +104,33 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
assertEquals("Exact number of downloads", 2, src.downloadCount);
}
+ /**
+ * Same as {@link #testFailToCanonical()} but with 3 mirrors:
+ * <ul>
+ * <li><code>mirror-one</code>, which is unreachable</li>
+ * <li><code>mirror-two</code>, which has an invalid optimized artifact and causes processing step to fail</li>
+ * <li>original repository, which has a valid canonical artifact</li>
+ * </ul>
+ *
+ */
+ public void testFailToCanonicalWithMirrors() {
+ OrderedMirrorSelector selector = new OrderedMirrorSelector(sourceRepository);
+ try {
+ RemoteRepo src = new RemoteRepo((SimpleArtifactRepository) sourceRepository);
+
+ IArtifactKey key = new ArtifactKey("test.txt", "fail_to_canonical", Version.parseVersion("1.0.0"));
+ MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, getTransport());
+ request.perform(src, new NullProgressMonitor());
+
+ assertTrue(request.getResult().toString(), request.getResult().isOK());
+ assertTrue(String.format("Target does not contain artifact %s", key), targetRepository.contains(key));
+ assertEquals("Exact number of downloads", 3, src.downloadCount);
+ assertEquals("All mirrors utilized", selector.mirrors.length, selector.index);
+ } finally {
+ selector.clearSelector();
+ }
+ }
+
// Test that SimpleArtifactRepository & MirrorRequest use mirrors in the event of a failure.
public void testMirrorFailOver() {
OrderedMirrorSelector selector = new OrderedMirrorSelector(sourceRepository);
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/emptyJarRepo/mirror-two/plugins/fail_to_canonical_1.0.0.txt.pack.gz b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/emptyJarRepo/mirror-two/plugins/fail_to_canonical_1.0.0.txt.pack.gz
new file mode 100644
index 000000000..c57eff55e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/artifactRepo/emptyJarRepo/mirror-two/plugins/fail_to_canonical_1.0.0.txt.pack.gz
@@ -0,0 +1 @@
+Hello World! \ No newline at end of file

Back to the top