From d318c839e3688499c0f8ab1990579b11e908fd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Sat, 16 Dec 2023 12:05:34 +0100 Subject: [PATCH] Disable P2 mirrors by default Having p2 mirrors enabled has some drawbacks as it can lead to instabilities see https://github.com/eclipse-equinox/p2/pull/414 also test can fail because a mirror can't be reached or is slow. Because of this we should disable mirrors all together and only selectively enable them for tests where this is required. --- .../test/p2Repository/P2RepositoryPropertiesTest.java | 6 ++++++ .../tycho/test/AbstractTychoIntegrationTest.java | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/P2RepositoryPropertiesTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/P2RepositoryPropertiesTest.java index 0a4714c5d8..56c41f2147 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/P2RepositoryPropertiesTest.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/P2RepositoryPropertiesTest.java @@ -78,4 +78,10 @@ public void testPropertyPropagation() throws Exception { assertTrue(properties.containsKey(TychoConstants.PROP_PGP_SIGNATURES) && !properties.get(TychoConstants.PROP_PGP_SIGNATURES).isBlank()); } + + @Override + protected boolean isDisableMirrors() { + // we want to test mirror properties... + return false; + } } diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java index e0505f8331..5254ea12d8 100644 --- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java +++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java @@ -90,6 +90,9 @@ protected Verifier getVerifier(String test, boolean setTargetPlatform, File user Verifier verifier = new Verifier(testDir.getAbsolutePath()); verifier.setForkJvm(isForked()); + if (isDisableMirrors()) { + verifier.setSystemProperty("tycho.disableP2Mirrors", "true"); + } String debug = System.getProperty("tycho.mvnDebug"); if (debug != null) { System.out.println("Preparing to execute Maven in debug mode"); @@ -146,6 +149,14 @@ protected Verifier getVerifier(String test, boolean setTargetPlatform, File user } + /** + * can be overridden by subclass to explicitly enable mirrors, by default they are disabled. + * + */ + protected boolean isDisableMirrors() { + return true; + } + protected boolean isForked() { return true; }